mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-16 05:00:24 +00:00
AcceptCallback may now return created/see_other tuples for POST
They replace and deprecate the {true,URI} return value.
This commit is contained in:
parent
63a6b86fba
commit
8795233c57
4 changed files with 73 additions and 4 deletions
|
@ -1104,6 +1104,14 @@ process_content_type(Req, State=#state{method=Method, exists=Exists}, Fun) ->
|
|||
next(Req2, State2, fun maybe_created/2);
|
||||
{false, Req2, State2} ->
|
||||
respond(Req2, State2, 400);
|
||||
{{created, ResURL}, Req2, State2} when Method =:= <<"POST">> ->
|
||||
Req3 = cowboy_req:set_resp_header(
|
||||
<<"location">>, ResURL, Req2),
|
||||
respond(Req3, State2, 201);
|
||||
{{see_other, ResURL}, Req2, State2} when Method =:= <<"POST">> ->
|
||||
Req3 = cowboy_req:set_resp_header(
|
||||
<<"location">>, ResURL, Req2),
|
||||
respond(Req3, State2, 303);
|
||||
{{true, ResURL}, Req2, State2} when Method =:= <<"POST">> ->
|
||||
Req3 = cowboy_req:set_resp_header(
|
||||
<<"location">>, ResURL, Req2),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue