hello, i use a ktor client and i currently try to...
# ktor
t
hello, i use a ktor client and i currently try to supply a base URL using the
DefaultRequest
plugin as described here: https://ktor.io/docs/default-request.html#configure i tried suppling the URL as complete string:
Copy code
defaultRequest {
    url("<https://ktor.io/docs/>")
}
and also tried setting the URL parameters by myself:
Copy code
url {
    protocol = URLProtocol.HTTPS
    host = "<http://ktor.io|ktor.io>"
    path("docs/")
}
the base URL i try to set is:
Copy code
<https://api.ws.sonos.com/control/api/v1>
during debugging, the plugin shows the correct URL including all path segments. but the
GET
request is executed without the path segments. i receive this response (path is missing):
Copy code
You don't have permission to access "http&#58;&#47;&#47;api&#46;ws&#46;sonos&#46;com&#47;households" on this server.
for request:
Copy code
httpClient.get("/households")
am i doing something wrong? is this a known issue?
1
btw. my token is valid. when i pass the whole URL to GET request, the request works.
updating from ktor 2.0.0 to 2.1.2 did not solve it.
i found the mistake that i made! 🎉 the base url has to end with a `/`:
Copy code
<https://api.ws.sonos.com/control/api/v1/>
and then this request will be successful:
Copy code
httpClient.get("households")
🤷‍♂️