XMLHttpRequest.getAllResponseHeaders should return lowercase header fields in sorted order #32353
Labels
Needs: Triage 🔍
🌐Networking
Related to a networking API.
Platform: Linux
Building on Linux.
Stale
There has been a lack of activity on this issue and it may be closed soon.
Description
The getAllResponseHeaders() specification indicates that "Let initialHeaders be the result of running sort and combine with this’s response’s header list", where a sort and combine is defined in the Fetch specification as "the result of convert header names to a sorted-lowercase set with all the names of the headers in list."
Basically we should expect to see "content-type" not "Content-Type" similar to what you'd see when running on a web browser.
React Native version:
System:
OS: Linux 5.4 Ubuntu 20.04.3 LTS (Focal Fossa)
CPU: (8) x64 Intel(R) Core(TM) i7-3770K CPU @ 3.50GHz
Memory: 3.14 GB / 31.31 GB
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 16.10.0 - /tmp/yarn--1633648470824-0.633831050292539/node
Yarn: 1.19.1 - /tmp/yarn--1633648470824-0.633831050292539/yarn
npm: 7.24.0 - /usr/bin/npm
Watchman: Not Found
SDKs:
Android SDK:
API Levels: 29, 30, 31
Build Tools: 29.0.3, 30.0.2, 31.0.0
System Images: android-29 | Intel x86 Atom_64, android-29 | Google Play Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: Not Found
Languages:
Java: 11.0.11 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.66.0 => 0.66.0
npmGlobalPackages:
react-native: Not Found
Done in 2.82s.
Steps To Reproduce
Provide a detailed list of steps that reproduce the issue.
Expected Results
A sorted list of the headers with the field names lowercased. For example:
Instead the headers fields are retured verbatim:
I think the fix in https://github.com/facebook/react-native/blob/main/Libraries/Network/XMLHttpRequest.js#L421 isn't too bad -- perhaps we should be using this._lowerCaseResponseHeaders and sort the result instead of this.responseHeaders?
The text was updated successfully, but these errors were encountered: