Ensure correct encoding is used for Content-Types that are lower-case or aliases #543
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.
Somewhere along the line, it looks like responses stopped getting the encoding specified by the
Content-Type
header applied unless the header’s value was an exact, case-sensitive match for an encoding’s name in Ruby.In a lot of real-world scenarios, encodings will be referenced in lower-case (internally, they are all upper-case in Ruby) or by other well-known aliases, e.g.
eucKR
is an alias forEUC-KR
andCP65001
is an alias forUTF-8
.This also updates tests—they were previously passing erroneously and didn’t actually test the behavior they were meant to. Test values were already correct and didn’t need the behavior the tests were looking for to be applied.
This fixes #542 and possibly #541.