Repository navigation
modifyHeaders fails when a value is added to or removed from a header that was set - #1088
Closed
chuuminggg wants to merge 1 commit into
Closed
chuuminggg wants to merge 1 commit into
chuuminggg wants to merge 1 commit into
Conversation
Previously, modifyHeaders() put the fixed-size list of values passed to set into the headers. A later modification that added a value to or removed a value from the same header then failed with an UnsupportedOperationException. A copy of the values is now used. Signed-off-by: chuuminggg <rorrxr@naver.com>
Member
|
Thanks for the suggestion but I consider that to be a misuse of the API. |
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.
When
modifyHeaders()sets a header and a later modification adds or removes a value of the same header, preprocessing fails with anUnsupportedOperationException:set(String, String...)stores its values asArrays.asList(values), andSetHeaderModificationputs that fixed-size list into the headers as it is. The add modification then callsHttpHeaders.add, which appends to that list. The remove-value modification callsList.removeon it.This PR makes
SetHeaderModificationput a copy of the values into the headers. The list in the headers can then be modified. Each request and response also gets its own list, so modifying one doesn't change the values that the preprocessor sets on the next one.The new tests cover adding a value to a header that was set and removing a value from it, for both a request and a response.