xxfast
03/27/2025, 11:56 PMdefaultRequest
plugin
When you set a url with no trailing slash, the plugin adds it to the request for me. Which is fine 👍
val baseUrl = "<https://api.github.com>" // No trailing slash
val client = HttpClient { defaultRequest { url(baseUrl) }
client.get("users") // REQUEST -> <https://api.github.com/users>
However, if there are additional path segments, it strips the last one off and adds trailing slash, malforming my url, which is bad 👎
val baseUrl = "<https://api.github.com/api/v1>" // No trailing slash + extra path segments
val client = HttpClient { defaultRequest { url(baseUrl) }
client.get("users") // REQUEST -> <https://api.github.com/api/users>
Note how the v1
is removed from the request outbound
I would expect it to return <https://api.github.com/api/v1/users>
instead
Is this the expected behaviour? or a bug?ephemient
03/28/2025, 2:10 AMxxfast
03/28/2025, 2:34 AM/
?ephemient
03/28/2025, 2:34 AMxxfast
03/28/2025, 2:36 AMKibet Theophilus
03/28/2025, 9:10 AM