Skip to content

No way to encode forward-slash in path #72

Open
@tyrel

Description

@tyrel

I cannot find a way to encode a forward-slash (/) into a path in HTTPBuilder (as %2F).

Example:

def http = new HTTPBuilder('https://gitlab.com/api/v3/')
http.setHeaders ['PRIVATE-TOKEN': API_TOKEN]
http.get(path: 'projects/group-name%2Fproject-name') { resp, json ->
   // ...
}

I need to have %2F encoded in order to identify the project in the GitLab API. According to their API documentation:

If using namespaced projects call make sure that the NAMESPACE/PROJECT_NAME is URL-encoded, eg. /api/v3/projects/diaspora%2Fdiaspora (where / is represented by %2F).

However, if I make this call, the underlying code in HTTPBuilder calls a constructor of java.net.URI which escapes the % causing it to be %%2F, which then returns a 404 Not Found from the server. Similarly I can't just put /, because that also returns a 404 Not Found. I must send just %2F.

I can't find a way to pass the path so that URI doesn't escape the %.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions