Skip to content

support relative paths #73

Description

@craffael

A REST API endpoint often has a "baseURI" such as https://api.mailgun.net/v3. A concrete endpoint has e.g. the full URI https://api.mailgun.net/v3/abc.ch/events.

It would now be very nice if we could write:

RESTClient client = new RESTClient("https://api.mailgun.net/v3")
client.get(path: "abc.ch/events")

Unfortunately this results in a GET request to https://api.mailgun.net/abc.ch/events instead of https://api.mailgun.net/v3/abc.ch/events (the v3 is missing!).

Therefore I propose that the path of the baseURI and the provided path (from the client.get() call) are merged to create the final URI. At the moment the path of the baseURI is replaced.

I think it would be a very simple change in groovyx.net.http.URIBuilder#setPath() which I could submit myself. What do you think?

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