-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix broken Head302Test #1421
Conversation
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
The Travis build failure appears to be related to #1380:
ReactiveStreamsTest.testConnectionDoesNotGetClosed:95 Invalid response byte at position 12000 expected [111] but found [45]
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...
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
Head302Testbecause 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.