fix: Invalidate the request URL even when the response has no headers - #153
Merged
Merged
Conversation
A response cut short by a timeout or a connection reset can reach the delete path with nil headers, and reading Location out of it raised NoMethodError inside on_complete. Fall back to an empty header set so the request URL is still invalidated. Fixes #142
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #142. On an unsafe method, a response cut short by a timeout or reset arrives with
status 0and no headers,should_delete?lets it through, anddeleteraisedNoMethodErrorreadingLocationfrom nil insideon_complete. Treat missing headers as empty and still invalidate the request URL.The spec uses a tiny adapter that finishes the env with
response_headers = nil, since the:testadapter normalizes nil into an empty header set and can't reproduce this. It raises the reported error against master and passes here, on Faraday 2 and 1.