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

fix NPE in Populate the :trace-redirects response field #327 PR #341

Merged
merged 3 commits into from Dec 13, 2016

Conversation

jiacai2050
Copy link
Contributor

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

@jiacai2050
Copy link
Contributor Author

Any question with this PR ?

Copy link
Owner

@dakrone dakrone left a 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 %)
Copy link
Owner

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))

Copy link
Contributor Author

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

@jiacai2050
Copy link
Contributor Author

jiacai2050 commented Dec 7, 2016

Redirect control is reasonable, We can use RequestConfig.setRedirectsEnabled() method to toggle it.

@dakrone
Copy link
Owner

dakrone commented Dec 9, 2016

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?

@jiacai2050
Copy link
Contributor Author

clj-http already has support for redirect control in here, I add one more test case for it

@dakrone dakrone merged commit 5bae92e into dakrone:master Dec 13, 2016
@dakrone
Copy link
Owner

dakrone commented Dec 13, 2016

Merged, thanks!

@mrkam2
Copy link

mrkam2 commented Nov 17, 2023

wrap-redirect is marked as deprecated but what's the recommended alternative API to use? Would be great to include that into the docstring in a phrase such as "Deprecated, use ... instead".

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

Successfully merging this pull request may close these issues.

None yet

3 participants