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
fix NPE in Populate the :trace-redirects response field #327 PR #341
Conversation
Any question with this PR ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a comment on this, but what I'm really concerned about is that there is now no way to disable redirects. There are some cases where a redirect needs to be handled by client code (think SAML SSO) instead of by the Apache HTTP library, so I think we should still have a way to disabling redirects.
Thoughts?
@@ -308,7 +308,9 @@ | |||
:protocol-version {:name (.getProtocol protocol-version) | |||
:major (.getMajor protocol-version) | |||
:minor (.getMinor protocol-version)} | |||
:reason-phrase (.getReasonPhrase status)})) | |||
:reason-phrase (.getReasonPhrase status) | |||
:trace-redirects (mapv #(.toString %) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can just be (mapv str (.getRedirectLocations))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it's more idiomatic
Redirect control is reasonable, We can use RequestConfig.setRedirectsEnabled() method to toggle it. |
Would you be willing to extend the PR to expose that as a boolean option? |
clj-http already has support for redirect control in here, I add one more test case for it |
Merged, thanks! |
|
In order to fix NPE in #327 , I have to update two tests dealing with redirect , since I have removed
wrap-redirects
middleware, so it is impossible for clj-http to control redirect behavior