Skip to content

Avoid redirection #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
edsko opened this issue Aug 20, 2013 · 8 comments
Closed

Avoid redirection #3

edsko opened this issue Aug 20, 2013 · 8 comments

Comments

@edsko
Copy link
Contributor

edsko commented Aug 20, 2013

DELETE, PUT, and (in some cases) POST should not redirect, but rather return a document indicating the location of the new resource, if necessary, or other cues to continue browsing.

@dcoutts
Copy link
Contributor

dcoutts commented Aug 20, 2013

Hmm? Redirection is fine as far as I know.

@edsko
Copy link
Contributor Author

edsko commented Aug 20, 2013

@dcoutts

git blame TODO
<...>
3d8dfe07 (Matthew Gruen  2010-08-16 18:06:27 +0000 32)  * DELETE, PUT, and (in some cases) POST should not redirect, but rather return
7641f204 (Matthew Gruen  2010-08-22 00:41:20 +0000 33)      a document indicating the location of the new resource, if necessary, or other
3d8dfe07 (Matthew Gruen  2010-08-16 18:06:27 +0000 34)      cues to continue browsing. 

@dcoutts
Copy link
Contributor

dcoutts commented Aug 20, 2013

I don't think I agree with him. :-)

@dcoutts
Copy link
Contributor

dcoutts commented Aug 20, 2013

@gracenotes any comments?

@gracenotes
Copy link
Contributor

I think this was originally intended as a RESTful HTTP purist idea. If you created something, return 201, for instance, or maybe 204 for deletion. One of the pragmatic reasons for violating this is that post/redirect/get helps prevent duplicate form submission in web browsers, and it can make for a not-slick user experience.

@dcoutts
Copy link
Contributor

dcoutts commented Aug 26, 2013

Ah sorry @gracenotes, I didn't read the full text :-)

Yes, using a normal 201/204 response with a body rather than a redirect is indeed reasonable and RESTful. It's not a bad UI necessarily, since it gives you confirmation that something did happen, and the response can link through to the new resource or whatever.

I was just reading the title "avoid redirection" and assumed that meant in general.

Are there many places where we are using redirection rather than a response body for PUT/DELETE?

@gracenotes
Copy link
Contributor

If there is, I don't really remember. Should make a pass-through. This was listed as a general style TODO, and it probably should be in a style guide for writing features.

@gracenotes
Copy link
Contributor

There seems to be some in the PackageCandidates feature (there are FIXMEs there).

hvr pushed a commit that referenced this issue Jul 9, 2017
Update aeson, tagsoup, optparse-applicative
@gbaz gbaz closed this as completed Jan 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants