Should I stop redirecting after successful POST or PUT requests?

Posted by Andres Jaan Tack on Stack Overflow See other posts from Stack Overflow or by Andres Jaan Tack
Published on 2010-06-12T17:30:08Z Indexed on 2010/06/12 17:32 UTC
Read the original article Hit count: 364

Filed under:
|
|

It seems common in the Rails community, at least, to respond to successful POST, PUT or DELETE requests by redirecting instead of returning success. For instance, if I PUT a legal change to my user profile, the idiomatic response would be a 302 Redirect to the profile page.

Isn't this wrong? Shouldn't we be returning 200 OK from the request? Or a 201 Created, in the case of a POST request? Either of those, in the HTTP/1.1 Status Definitions are allowed to (or required to) include a response, anyway.

I guess I'm wondering, before I go and "fix" my application, whether there is there a darn good reason why the community has gone the way of redirects instead of successful responses.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about http