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

Accepting a JSON Request Body #22

Closed
albertoleal opened this issue Nov 18, 2015 · 2 comments
Closed

Accepting a JSON Request Body #22

albertoleal opened this issue Nov 18, 2015 · 2 comments

Comments

@albertoleal
Copy link

Thank you for Mappersmith! It's an amazing client ;)

The documentation says that a urlencoded version of the object will be used when sending values in the request body.

I wonder if that's possible to check the content type before creating a urlencoded version. In my case, the API only works with json objects.

Is there any way to send a json object in the request body?

thanks!

@tulios
Copy link
Owner

tulios commented Nov 18, 2015

Hi @albertoleal, thanks. It's possible to send whatever you want to :)

Mappersmith will convert only objects to urlencoded, for a JSON body you can do:

Client.Photo.save({
  category: 'family',
  body: JSON.stringify({year: 2015, tags: ['party', 'family']})
})

@albertoleal
Copy link
Author

Great, @tulios! Thanks!

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

No branches or pull requests

2 participants