Skip to content

Path encoding with "/" as part of the id #39

Description

@Deitsch

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions