Add a --max-redirects option #188

Closed
tylercrompton opened this Issue Dec 20, 2013 · 2 comments

4 participants

@tylercrompton

Right now, we rely on the default max redirects set forth by Requests, which is currently 30. I think we should have an option to tinker around with this. It should be extremely easy to implement. It'd be a matter of adding about ten lines to httpie/cli.py, adding one to three and changing one or two in httpie/client.py.

Current Behavior:

$ http --follow http://httpbin.org/redirect/31

http: error: TooManyRedirects: Exceeded 30 redirects.

Proposed Behavior:

$ http --follow --max-redirects=31 http://httpbin.org/redirect/31
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 261
Content-Type: application/json
Date: Fri, 20 Dec 2013 03:54:45 GMT
Server: gunicorn/0.17.4

{
    "args": {}, 
    "headers": {
        "Accept": "*/*", 
        "Accept-Encoding": "gzip, deflate, compress", 
        "Connection": "close", 
        "Host": "httpbin.org", 
        "User-Agent": "HTTPie/0.8.0-dev"
    }, 
    "origin": "24.197.59.36", 
    "url": "http://httpbin.org/get"
}
@jkbrzt jkbrzt added feature planned and removed planned labels Apr 10, 2014
@Oxicode

+1

@JamesDavidCarr

I made a pull request a while ago for this.

Hoping that I can get some feedback from you both about how this compares to what you expected.

#246

@jkbrzt jkbrzt added a commit that referenced this issue Feb 29, 2016
@jkbrzt Added --show-redirects and --max-redirects
Closes #157, #183, #188, #246
356e043
@jkbrzt jkbrzt closed this Feb 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment