开发者

Rails 3 GET Method, No request.body

开发者 https://www.devze.com 2023-03-29 10:03 出处:网络
I\'m wondering why when I use a route to a controller that uses a GET method, Rails str开发者_如何转开发ips the request\'s body out. If I change the route definition to POST, the body comes through.

I'm wondering why when I use a route to a controller that uses a GET method, Rails str开发者_如何转开发ips the request's body out. If I change the route definition to POST, the body comes through.

I am trying to send a JSON encoded options hash to GET /customer/find so that it returns a list of customers. It's not changing anything, so it shouldn't be a POST.

Someone please explain what I'm missing here.

EDIT:

http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html details that a POST request doesn't have to create something, however it should return 201 if it does. Status codes of 200 (OK), 204(No Content) are valid for POST methods as well. Question awarded to aVenger for his comment on his answer.


Why don't you just send your json hash as a request parameter? If it's too big, you should use POST anyway.

0

精彩评论

暂无评论...
验证码 换一张
取 消