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

Interceptors should be called before the data is transformed #352

Closed
Cristofori opened this issue Jun 21, 2016 · 1 comment

Comments

@Cristofori
Copy link

commented Jun 21, 2016

This issue was introduced in the 0.9.0 release.

axios.interceptors.request.use(function(config) {
  console.log(typeof config.data)
  return config;
})

...

axios.post('/some/url/', {foo: 'bar'})

Output in 0.8.1: 'object'
Ouput in 0.9.0+: 'string'

Prior to 0.9.0 the interceptor would be given the actual JS object that was passed to the post method. Now it appears to be passed through transformData before the interceptor, forcing users to parse the data from JSON back into a JS object before being able to manipulate it, and then turn it back into a JSON string when returning it.

@mzabriskie

This comment has been minimized.

Copy link
Member

commented Jun 23, 2016

You're right, this was broken with #183. Thanks for catching this. Will work on getting a patch out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.