-
Notifications
You must be signed in to change notification settings - Fork 71
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
Why enforcing content-type? #27
Comments
Hi @ericholiveira, thanks for opening this issue. I agree with you, Mappersmith should always follow the user defined content-type. Currently, you can prevent Mappersmith from guessing the content type by setting the body attribute to something different than an object, example: Client.Photo.save({
category: 'family',
body: JSON.stringify({year: 2015, tags: ['party', 'family']})
}) I will fix this and release a new version. Thanks for your input! |
Great... ive tried like you said before opening this issue and what i got was a request with content-type "application/x-www-form-urlencoded; charset=UTF-8; application/json" , the body was sent correctly, as a json string, but the server could read because this wasnt an explicit application/json header. Anyway, thx for the help :) |
I released version 0.13.2 with this fix. Thanks for your input. |
First of all, congratz for the amazing lib.
Ive been trying it in a new project using play framework as the backend, the problem is, with the current gateways i cant send any post data because Mappersmith always concatenate "application/x-www-form-urlencoded; charset=UTF-8;" on the request, this way play cant understand that im trying to send an application/json (even if i put it in the headers rule).
So i basically had to copy/paste the gateway to make it stop enforcing the form content-type. This is obviously a bad solution, so do you have plans to stop enforcing this content-type? You may first check the user header options and only the user didnt add a Content-type then you can put it.
I can even do a PR if you dont have the time to do this.
Thanks
The text was updated successfully, but these errors were encountered: