Closed Roeland-Bouvet closed 2 years ago
I assume it is safer that the caller does this encoding?
You can use encodeURI
, if you are concerned about spaces.
http.request({
url: encodeURI('http://example.com/my/url/?= ')
})
Doing it in the library itself is unsafe.
Ok. Out of curiosity though, is it possible in versions 2.x.x the library was in fact doing url-encoding? With okhttp3.HttpUrl.parse ?
The backend has been changed from okhttp3 to native HttpClient in version 3.0.0 Native HttpClient accepts only valid URI.
Hi, the request function currently throws a "java.lang.IllegalArgumentException: Illegal character in path at..." error when the url parameter contains a space. Ideally people shouldn't be using spaces in urls when making requests, but there can be cases where this could happen. So perhaps the http-client lib should try to url-encode before making the request?