aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2012-02-20 08:33:54 +0100
committerLoïc Hoguin <[email protected]>2012-02-20 08:33:54 +0100
commitf6cf731011a66906c4a7077e4df5806b342c4dfe (patch)
treeba46b4fb14953699c820c3f04b9641a3499c67de
parentf51493ee376f0ea9eef137f19e6fd0e16e199b8e (diff)
downloadcowboy-f6cf731011a66906c4a7077e4df5806b342c4dfe.tar.gz
cowboy-f6cf731011a66906c4a7077e4df5806b342c4dfe.tar.bz2
cowboy-f6cf731011a66906c4a7077e4df5806b342c4dfe.zip
REST: Only send 201 when a new resource is created on POST
-rw-r--r--src/cowboy_http_rest.erl2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cowboy_http_rest.erl b/src/cowboy_http_rest.erl
index 392b172..8f14388 100644
--- a/src/cowboy_http_rest.erl
+++ b/src/cowboy_http_rest.erl
@@ -699,7 +699,7 @@ process_post(Req, State) ->
terminate(Req2, State#state{handler_state=HandlerState});
{true, Req2, HandlerState} ->
State2 = State#state{handler_state=HandlerState},
- next(Req2, State2, 201);
+ next(Req2, State2, fun is_new_resource/2);
{false, Req2, HandlerState} ->
State2 = State#state{handler_state=HandlerState},
respond(Req2, State2, 500)