Skip to content

Fix broken Head302Test #1421

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

Merged
merged 2 commits into from
Jun 9, 2017
Merged

Fix broken Head302Test #1421

merged 2 commits into from
Jun 9, 2017

Conversation

ssoloff
Copy link
Contributor

@ssoloff ssoloff commented Jun 9, 2017

I was originally going to report a bug that my HEAD requests were being switched to GET upon a 301 redirect. Then I came across #989 and learned that this behavior is by design. 😄

However, before I discovered that issue, I was playing around with Head302Test because it seemed to confirm my impression that the HEAD method should be preserved upon a redirect. It was at this time that I discovered this test was falsely passing.

I first updated the test to demonstrate that it actually fails. Then I modified it to conform to the behavior described in #989 so that it now passes. This PR captures both of these changes.

ssoloff added 2 commits June 9, 2017 13:08
This test had the following defects which caused it to falsely pass:

* Jetty requires a handler to explicitly indicate it has handled the
request by calling Request.setHandled(true).  Otherwise the server will
return 404.
* The test did not configure the client to follow redirects.
* The test itself wasn't asserting anything useful beyond that the
request did not time out.  To ensure the redirect was followed, it needs
to assert the expected response status code from the redirected location
is received.
The test now verifies that a HEAD redirected via 302 is switched to GET
per [1].

[1] #989
@ssoloff
Copy link
Contributor Author

ssoloff commented Jun 9, 2017

The Travis build failure appears to be related to #1380:

ReactiveStreamsTest.testConnectionDoesNotGetClosed:95 Invalid response byte at position 12000 expected [111] but found [45]

@slandelle slandelle merged commit 3c25a42 into AsyncHttpClient:master Jun 9, 2017
@slandelle
Copy link
Contributor

Thanks a lot!

The Travis build failure appears to be related to #1380:

Yep. It takes hundreds of cycles on my machine to reproduce. I guess I would have to run on a small Docker container so I can investigate, and I don't have time for that atm, even though this one gets me nuts... The issue could be anywhere: JDK, Netty, AHC, netty-reactive-streams, Jetty, rx-java...

@ssoloff ssoloff deleted the head-redirect-converted-to-get branch June 9, 2017 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants