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 allow_redirects option to FastHttpSession.request #1238

Closed
kevinwainczak opened this issue Jan 21, 2020 · 7 comments
Closed

Add allow_redirects option to FastHttpSession.request #1238

kevinwainczak opened this issue Jan 21, 2020 · 7 comments

Comments

@kevinwainczak
Copy link

Is your feature request related to a problem? Please describe.

I'm trying to convert my use of HttpLocust to FastHttpLocust, but I am unable to do so because my code critically relies on being able to set allow_redirects to False.

Describe the solution you'd like

I want an allow_redirects option supported in FastHttpSession.request such that passing the value True (or not passing a value at all) will automatically perform redirects from a 3xx response and passing the value False will not perform any redirect resulting from a 3xx response.

Describe alternatives you've considered

I have considered looking at the Referer/Location that comes back, however I'm unable to inspect the headers after the redirect has been performed. I'm also unable to find the current location after the response has been completed.

Additional context

I need to parse the location URL where the response is saying to redirect.

@cyberw
Copy link
Collaborator

cyberw commented Jan 21, 2020

It is super annoying, but I dont think geventhttpclient supports this, so I'm not sure we can build it (without patching geventhttpclient, which is of course possible, but pretty dirty...)

@cyberw
Copy link
Collaborator

cyberw commented Jan 22, 2020

Actually, there might be a way. I was looking for a way to control timeouts and found a setting for redirects as well. I'll get back to you...

@cyberw
Copy link
Collaborator

cyberw commented Jan 23, 2020

I found a (dirty) workaround. Before your request (preferably in the TaskSet.on_start() method or something) do this:

self.client.client.redirect_resonse_codes = []

GeventHttpClient will no longer recognize the response as a redirect and you'll be able to investigate the initial response in all its glory.

@heyman
Copy link
Member

heyman commented Jan 24, 2020

Since we’re already wrapping the geventhttpclient, I think we could implement support for an allow_redirects parameter pretty easily (by setting the redirect_response_codes).

@malithlk
Copy link

@heyman any update on this ?

@heyman
Copy link
Member

heyman commented Apr 20, 2020

@masthijohna Nope, not that I know of.

@cyberw
Copy link
Collaborator

cyberw commented Apr 20, 2020

Fixed!

@cyberw cyberw closed this as completed Apr 20, 2020
cyberw added a commit that referenced this issue Apr 21, 2020
…to-FastHttpLocust.client.request()

Add allow_redirects parameter to FastHttpLocust.client.request(). Fixes #1238
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants