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

Add a --max-redirects option #188

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

Add a --max-redirects option #188

tylercrompton opened this issue Dec 20, 2013 · 2 comments
Labels
enhancement New feature or enhancement

Comments

@tylercrompton
Copy link

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 and removed planned labels Apr 10, 2014
@Oxicode
Copy link

Oxicode commented Jun 18, 2014

+1

@JamesDavidCarr
Copy link
Contributor

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 added a commit that referenced this issue Feb 29, 2016
@jkbrzt jkbrzt closed this as completed Feb 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or enhancement
Projects
None yet
Development

No branches or pull requests

4 participants