-
-
Notifications
You must be signed in to change notification settings - Fork 11k
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
Fixing response with utf-8 BOM can not parse to json #2419
Conversation
Just saying I'd love to see this merged as I have to use an annoying workaround to use Axios with our legacy .Net services. (They all return a BOM character.) |
@Morgul I think you can solve it by add another
|
@chinesedfan That works, as a work around, but I'd love to see this merged in, as axios is one of the few libraries that doesn't automatically work around this issue. 🙁 |
@Morgul Would you mind to list some examples? I am glad to check their implementations. And also make preparations for some users who want to keep those BOMs. |
@chinesedfan Here are some examples to avoid these problems. (Windows system save file with BOM, but not all HTTP services handle it) |
* add checkServerIdentity to request config for http adapter * add checkServerIdentity unit test * add checkServerIdentity doc * add more unit tests for checkServerIdentity * remove ssl-root-cas dependency * add changes description to changelog * Fixing response with utf-8 BOM can not parse to json (#2419) * fix: remove byte order marker (UTF-8 BOM) when transform response * fix: remove BOM only utf-8 * test: utf-8 BOM * fix: incorrect param name Co-authored-by: Jay <jasonsaayman@gmail.com> * Update mergeConfig.js Co-authored-by: Yasu Flores <carlosyasu91@gmail.com> Co-authored-by: Cr <631807682@qq.com> Co-authored-by: Jay <jasonsaayman@gmail.com>
* fix: only set responseType 'json' or use defaulte responseType return JSON response * test: change defalut transform behaviour * refactor: try to parse json * fix: code style * test: response type json * fix: set default transformResponse to empty array * chore: code style * Fixing response with utf-8 BOM can not parse to json (#2419) * fix: remove byte order marker (UTF-8 BOM) when transform response * fix: remove BOM only utf-8 * test: utf-8 BOM * fix: incorrect param name Co-authored-by: Jay <jasonsaayman@gmail.com> * Update http.js * Fix trailing spaces * fix: strip Bom before parse to json Co-authored-by: Alanscut <948467222@qq.com> Co-authored-by: Jay <jasonsaayman@gmail.com> Co-authored-by: Cr <a631807682@qq.com>
* fix: remove byte order marker (UTF-8 BOM) when transform response * fix: remove BOM only utf-8 * test: utf-8 BOM * fix: incorrect param name Co-authored-by: Jay <jasonsaayman@gmail.com>
* fix: remove byte order marker (UTF-8 BOM) when transform response * fix: remove BOM only utf-8 * test: utf-8 BOM * fix: incorrect param name Co-authored-by: Jay <jasonsaayman@gmail.com>
* add checkServerIdentity to request config for http adapter * add checkServerIdentity unit test * add checkServerIdentity doc * add more unit tests for checkServerIdentity * remove ssl-root-cas dependency * add changes description to changelog * Fixing response with utf-8 BOM can not parse to json (axios#2419) * fix: remove byte order marker (UTF-8 BOM) when transform response * fix: remove BOM only utf-8 * test: utf-8 BOM * fix: incorrect param name Co-authored-by: Jay <jasonsaayman@gmail.com> * Update mergeConfig.js Co-authored-by: Yasu Flores <carlosyasu91@gmail.com> Co-authored-by: Cr <631807682@qq.com> Co-authored-by: Jay <jasonsaayman@gmail.com>
* fix: only set responseType 'json' or use defaulte responseType return JSON response * test: change defalut transform behaviour * refactor: try to parse json * fix: code style * test: response type json * fix: set default transformResponse to empty array * chore: code style * Fixing response with utf-8 BOM can not parse to json (axios#2419) * fix: remove byte order marker (UTF-8 BOM) when transform response * fix: remove BOM only utf-8 * test: utf-8 BOM * fix: incorrect param name Co-authored-by: Jay <jasonsaayman@gmail.com> * Update http.js * Fix trailing spaces * fix: strip Bom before parse to json Co-authored-by: Alanscut <948467222@qq.com> Co-authored-by: Jay <jasonsaayman@gmail.com> Co-authored-by: Cr <a631807682@qq.com>
* fix: remove byte order marker (UTF-8 BOM) when transform response * fix: remove BOM only utf-8 * test: utf-8 BOM * fix: incorrect param name Co-authored-by: Jay <jasonsaayman@gmail.com>
Some services(deploy on
Windows
) will response data withBOM
that can not parse it tojson
.see #1768 (comment)