Is there a way to redirect through a 201 answer?
The RFC specifies that the newly created resource must be specified in the Location
header, and I do specif
I am dealing with this for the first time, and this is what I have decided to do:
GET /user/new
-> 200 Ok
with user registration form.POST /user
-> 201 Created
a new user, respond with the same content as the GET /user
route.GET /user
-> 200 Ok
with the user profile page for the authenticated user, or, for anonymous visitors, 307 Temporary Redirect
to /login
, which links to /user/new
.update
I have found out that this is a bad idea, because if the user refreshes the page that was rendered as a response for POST /user
, they resend the post data. I will leave the answer here in case anyone else has the same brilliant idea.