Post request parameters getting truncated in Rails 4.2.2 with content type as “Application/xml”

Deadly 提交于 2019-12-11 12:47:57

问题


I have this below observation:

I deployed a sample Rails 4.2.2 application with a controller and action to receive a POST request.

Now If I send a POST request to this application with some POST body say a hash like {"1"=>"hello","2"=>"bye"} and if the content type of the request is "application/xml", I don't receive any parameters in my Rails app.

If I change content type of the same request to some thing else , I will get the parameters properly.

Can some one please tell my why this behaviour is there in Rails 4.2.2 with a POST request having content type as "application/xml".


回答1:


Automatic parsing of XML bodies was removed in rails 4.0 and extracted into a gem

Even with that gem your request body isn't valid XML.



来源:https://stackoverflow.com/questions/33407625/post-request-parameters-getting-truncated-in-rails-4-2-2-with-content-type-as-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!