You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To Reproduce
Try a test with this code:
let networking = Networking(baseURL: "https://httpbin.org")
let result = try await networking.get("/get",
parameters: [
"id":"7"
])
Probably just need to parse out the query parts (separated by ?, &), encode them and rebuild the request. It is just the "?" and "&" that should not be encoded.
Describe the bug
If you provide parameters to a Networking.get() command the URL that is generated will UTF8 encode the parameters and you get an invalid URL:
http://www.apple.com/?test=3 -> http://www.apple.com/%3Ftest=3
To Reproduce
Try a test with this code:
let networking = Networking(baseURL: "https://httpbin.org")
let result = try await networking.get("/get",
parameters: [
"id":"7"
])
Expected behavior
Return JSON result like:
{
"args": {
"id": "7"
},
"headers": {
"Accept": "/",
"Host": "httpbin.org",
"User-Agent": "curl/8.6.0",
"X-Amzn-Trace-Id": "Root=1-669ae9cd-10e47d480029deb76b63a84b"
},
"origin": "---",
"url": "https://httpbin.org/get?id=7"
}
It will actually fail with:
Error Domain=com.3lvis.networking Code=404 "not found" UserInfo={NSLocalizedDescription=not found}
<NSHTTPURLResponse: 0x60000249c020> { URL: https://httpbin.org/get%3Fid=7 } { Status Code: 404, Headers {
"Access-Control-Allow-Origin" = (
"*"
);
"Content-Length" = (
233
);
"Content-Type" = (
"text/html"
);
Date = (
"Fri, 19 Jul 2024 22:37:35 GMT"
);
Server = (
"gunicorn/19.9.0"
);
"access-control-allow-credentials" = (
true
);
} }
Screenshots
iOS Version (please complete the following information):
MacOS: 14.5
Framework Version (please complete the following information):
6.12
Additional context
Should not be encoding the ? in a URL.
The text was updated successfully, but these errors were encountered: