Distractic
11/05/2023, 10:19 AM// Definition of my client
val client = HttpClient {
...
defaultRequest {
url {
takeFrom("<http://localhost:8080>")
appendPathSegments("v1")
}
}
}
// Example of request
<http://client.post|client.post> {
url {
appendPathSegments("test", "test2)
}
}
With this code, the client will request: <http://localhost:8080/test/test2>
and not <http://localhost:8080/v1/test/test2>
However, if in the client definition, instead of v1
I put /v1/
, the client will request <http://localhost:8080/v1/test/test2>
as expected
Do you know why I have this behavior and how to fix it ?MV
11/05/2023, 10:47 AMDistractic
11/05/2023, 10:54 AM<http://localhost:8080/v1>
for all requests ? (instead of put /v1/
in add path)MV
11/05/2023, 10:56 AMdefaultRequest {
url("<http://localhost:8080/v1/>" )
}
No you need the trailling slashDistractic
11/05/2023, 10:57 AM