ruby - Content-Type "application/json" not required in rails -


I have an API endpoint in the train, by default if you have a content-type header process in the parameter

  application / x-www-form-urlencoded   

Is there a way to take action on json string in the rail by a post request without specifying content type Article?

In your routes.rb file you can post a namespace Define the format for the inner path and expectation of this type:

  Namespace: API, Default: {format :: json} Post 'Example' = & gt; 'Admin # Action' End   

In this case you will post your Jason Payload on '/api/example.json' and should not define the content-type. You may be able to define it for only one post line, but I have not tested it.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -