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

Refine how redirect method is set #829

Merged
merged 1 commit into from
May 25, 2022
Merged

Refine how redirect method is set #829

merged 1 commit into from
May 25, 2022

Conversation

quinnj
Copy link
Member

@quinnj quinnj commented May 25, 2022

Fixes #825. TIL: not all redirects should use the same method as
the original request, and in fact, most http client implementations
will default the new request method to GET. I included links to
a few useful discussions/references, but essentially the behavior
we now support is:

  • For 307/308 response status, use original request method; these
    statuses are specifically for indicating the original method is ok
  • For 303 response status, must use GET method
  • For other 3xx responses, it's actually legal to use the original
    method, but most client implementations will switch to GET,
    which means most servers have adapted to expect this and may even
    error if the original request method is used (as is the case in
    the originally reported issue). We now follow this behavior, though,
    like curl, allow overriding this behavior by a new redirect_method
    keyword arg to allow specifying the redirect method behavior.

Fixes #825. TIL: not all redirects should use the same method as
the original request, and in fact, most http client implementations
will default the new request method to GET. I included links to
a few useful discussions/references, but essentially the behavior
we now support is:
  * For 307/308 response status, use original request method; these
    statuses are specifically for indicating the original method is ok
  * For 303 response status, must use GET method
  * For other 3xx responses, it's actually legal to use the original
    method, but most client implementations will switch to GET,
    which means most servers have adapted to expect this and may even
    error if the original request method is used (as is the case in
    the originally reported issue). We now follow this behavior, though,
    like curl, allow overriding this behavior by a new `redirect_method`
    keyword arg to allow specifying the redirect method behavior.
@quinnj quinnj marked this pull request as ready for review May 25, 2022 05:13
@codecov-commenter
Copy link

codecov-commenter commented May 25, 2022

Codecov Report

Merging #829 (17966a5) into master (bd0e2a0) will decrease coverage by 0.16%.
The diff coverage is 60.00%.

@@            Coverage Diff             @@
##           master     #829      +/-   ##
==========================================
- Coverage   78.65%   78.48%   -0.17%     
==========================================
  Files          36       36              
  Lines        2506     2524      +18     
==========================================
+ Hits         1971     1981      +10     
- Misses        535      543       +8     
Impacted Files Coverage Δ
src/HTTP.jl 83.05% <ø> (ø)
src/Messages.jl 84.13% <0.00%> (-2.39%) ⬇️
src/RedirectRequest.jl 80.00% <75.00%> (-3.34%) ⬇️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@quinnj quinnj merged commit 54a6c13 into master May 25, 2022
@quinnj quinnj deleted the jq/redirect_method branch May 25, 2022 13:14
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.

got IOError during POST with Form email
2 participants