I'm struggling to send a request to the proper URL with path params that include a "/". I am aware that this is due to the additional "/" running against a different REST endpoint. Encoding the path param doesn't seem to work since it gets encoded again by Fetch internally. Any idea how to solve this? Is there an option to disable the internal encoding?
let id = "5/7"
APIClient.shared.setup(with: .init(baseURL: "https://some-url.com"))
try? await Resource<String>(
method: .get,
path: "/some-path/\(id)",
).requestAsync()
/some-path/5/7 ← What I request w/o encoding
/some-path/5%252F7 ← What I request with encoding
/some-path/5%2F7 ← What I actually would want to request
Here I recreated the issues:
https://github.com/Deitsch/fetch-encoding-issue/blob/main/fetch-encoding-issue/ContentView.swift
I'm struggling to send a request to the proper URL with path params that include a "/". I am aware that this is due to the additional "/" running against a different REST endpoint. Encoding the path param doesn't seem to work since it gets encoded again by Fetch internally. Any idea how to solve this? Is there an option to disable the internal encoding?
/some-path/5/7← What I request w/o encoding/some-path/5%252F7← What I request with encoding/some-path/5%2F7← What I actually would want to requestHere I recreated the issues:
https://github.com/Deitsch/fetch-encoding-issue/blob/main/fetch-encoding-issue/ContentView.swift