Skip to content
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

XMLHttpRequest#getResponseHeader should be case insensitive #190

Open
leeyeh opened this issue Nov 2, 2020 · 1 comment
Open

XMLHttpRequest#getResponseHeader should be case insensitive #190

leeyeh opened this issue Nov 2, 2020 · 1 comment
Assignees

Comments

@leeyeh
Copy link

leeyeh commented Nov 2, 2020

The search for the header name is case-insensitive.

https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/getResponseHeader

当前的实现没有忽略大小写:

return _responseHeader.get(this)[header]

这意味着如果 server 返回的是 Content-Type: application/json,而代码中使用 xhr.getResponseHeader('content-type') 拿到的会是 undefined。比如我们用的 superagent 就是这么用的: https://github.com/visionmedia/superagent/blob/aa43b3d27594d231afee9009ae740ce1b44a6f62/src/client.js#L351

请考虑在实现 getResponseHeader 时忽略 key 的大小写。感谢支持。

@PPpro PPpro self-assigned this Nov 3, 2020
@PPpro
Copy link
Collaborator

PPpro commented Nov 3, 2020

感谢反馈,我们之后跟标准同步一下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants