Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL's containing a URL encoded space (%20) return a 404 #25

Open
4np opened this issue May 27, 2014 · 3 comments
Open

URL's containing a URL encoded space (%20) return a 404 #25

4np opened this issue May 27, 2014 · 3 comments

Comments

@4np
Copy link

4np commented May 27, 2014

Hi Graeme,

I am using the plugin to consume a Jenkins instance, but some of the view names in there contain (out of my control) spaces. These result in URLs containing spaces (e.g. http://my.jenkins.instance.com/job/something/view/foo%20bar/api/json ). Such URLs fail due to a 404. I assume because the %20 get's url decoded and a request is done with a real space or something.

Example code:

        String url = "https://my.jenkins.instance.com/job/something/view/foo%20bar/api/json"
        def rest = new RestBuilder()
        def resp = rest.get(jsonUrl) {
            auth username, password
        }

        println rest.getStatusCode()
@aruizca
Copy link

aruizca commented Feb 3, 2015

+1
I am using the URIBuilder to generate a URL which correctly encodes the parameters. If I pass that URL to the RestBuilder instance it reencodes everything.

So for instance, if I generate a URL like this using the URIBuilder:

http://biocache.ala.org.au/ws/occurrences/search?q=cl22%3A%22New+South+Wales%22&facets=taxon_name&pageSize=0&flimit=50&foffset=0&fq=species_group%3A%22Mammals%22

the actual request looks something like this:

http://biocache.ala.org.au/ws/occurrences/search?q=cl22%253A%2522New%2BSouth%2BWales%2522&fq=species_group%253A%2522Mammals%2522

If I decode to UTF-8 before using the rest builder then it works unless there is an ampersand, "&", within the parameter values.

@aruizca
Copy link

aruizca commented Feb 3, 2015

Using the Groovy RESTClient for the time being. If I have time I will look into the problem and hopefully send a PR

@yuri1969
Copy link

+1
Re-encoding is a bummer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants