-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
Wrong Content-Type in 4.1.0 #86
Comments
I can't seem to replicate this - request headers correctly contained Only change is that axios is now just imported and used directly instead of being added to the class and used internally. This shouldn't have any effect on the headers though - the Also you'll want to add |
Hmm, I'll debug into this more once I am less sleep-deprived. Is there a way to get the non-minified versions of axios and kitsu browserified with all its dependencies so I can debug this in my application? |
Actually - the headers were changed from Don't have the time to do anything until the weekend, but reverting back to creating a new instance of Axios in the class constructor may fix this. You can use Browserify to bundle the dependencies into a single file. |
Yes, but how do I do that with the non-minified versions? My npm-fu is weak. I tried this in a source checkout:
It runs into this:
|
You'll need to target one of the |
OK, yep, that works, I have no idea how I managed not to try that variant during my attempts at randomly guessing how to get it right... So I think I've figured out the problem - could have figured that out just by staring harder at the code instead of spending hours making it debuggable, but it appears that the axios api actually changed: https://github.com/axios/axios/blob/master/README.md#axiospatchurl-data-config
kitsu does this: Lines 180 to 183 in 6b0ee2b
But should do this: const { data } = await axios.patch(url,
{data: (await serialise.apply(this, [ model, body, 'PATCH' ])).data},
{headers: headers}
) In my browserified js, this is what the working code looks like: var _ref2 = yield axios.patch(url,
{data: (yield serialise.apply(_this2, [model, body, 'PATCH'])).data},
{headers: headers}
);
const data = _ref2.data; If that analysis makes sense to you, I'll be happy to make a PR. |
The axios api apparently changed and we weren't looking. Headers are now passed to axios in separate "config" parameter dict instead of in the "data" dict. Fixes wopian#86
Fixed in |
I just upgraded from 3.1.4 to 4.1.0.
Here's how I initialize kitsu:
And here's how I make a request:
My requests should be sent with
application/vnd.api+json
Content-Type, but they aren't, no matter what I do it is sent withapplication/json;charset=utf-8
which happens to be the Axios default.So I suspect that something broke between 3.x and 4.x that causes Axios to no longer set / see the correct Content-Type.
Here is the libs I am using:
The text was updated successfully, but these errors were encountered: