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

Make default transformResponse parse JSON more properly #2856

Closed
wants to merge 3 commits into from

Conversation

chinesedfan
Copy link
Collaborator

@chinesedfan chinesedfan commented Mar 28, 2020

Similar PRs before,

Not sure this is the best solution, because it changes transformers with a new parameter and will break codes depending on silent parsing. So I will not fix tests until we have determined to do.

@@ -30,6 +30,7 @@ module.exports = function dispatchRequest(config) {
config.data = transformData(
config.data,
config.headers,
config,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chinesedfan Should we just pass the config.responseType parameter? And also need to update README.md.

  transformRequest: [function (data, headers) {
    // Do whatever you want to transform the data

    return data;
  }],

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just pass the config.responseType parameter?

Pass config has more applicable scenes, eg #842

@fnune
Copy link

fnune commented Apr 7, 2021

This also fixes #907 btw

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

Successfully merging this pull request may close these issues.

responseType=text but json is parsed How to handle error from JSON.parse
5 participants