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
Post a Comment