Fixing parse by responseType #2424
Conversation
|
Is anyone from the project looking these PRs? |
|
@jcrben I add unit test for |
|
Not really. Keep in mind I'm just a user like yourself (and a casual one at that). Maybe a maintainer will have an idea. |
|
@a631807682 #2570 will fix the CI failed. not your problem. |
|
Isn't it possible to remove the |
|
|
I don't mean to remove that feature entirely. I just mean the left-overs in the code which is: function transformResponse(data) {
return data;
}This is just a default implementation of a row of possible transform functions. The property The function But I've noticed that the test file Do you know what I mean, now? |
|
@alinnert I set |
* 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 <[email protected]>
|
Since this is a breaking change and changes the behaviour I have added it to v1 |
|
@a631807682 Please can you check tests? |
|
@jasonsaayman I fixed it, but i don't know why CI hasn't been triggered. |
* 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 <[email protected]> * Update http.js * Fix trailing spaces * fix: strip Bom before parse to json Co-authored-by: Alanscut <[email protected]> Co-authored-by: Jay <[email protected]> Co-authored-by: Cr <[email protected]>
|
Just a question. Is this change going to be released in 1.0 ? Automatic JSON parsing seemed always a bit strange to me. With current released version of Axios (0.21.4) one can at least disable it by I don't want Axios to parse JSON responses for me - I want to parse it by myself as I need to pass a custom reviver function into JSON.parse |
|
Good question it would be released in v1 but maybe it's the wrong approach |
|
@jasonsaayman We already have a transitional option |
Issue
Closes #907
Desc
responseType'json'should parse toJSON,'arraybuffer'/'blob'/'stream'return original response,'text'or''return string response.transformResponsebehavior should be same in nodejs and browser, data params should be a right type.