diff options
author | Loïc Hoguin <[email protected]> | 2013-04-12 13:24:40 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2013-04-12 13:24:40 +0200 |
commit | 1eb2bda3041ccc87690d74087011074db6699147 (patch) | |
tree | bab15310b8b56dbbaf21dd6b95e519c11c7cca86 /src/cowboy_rest.erl | |
parent | fa31c8259572d467ed7e95926c7530f61f775559 (diff) | |
parent | 180143f9b2ec8f82db11a89485140b1a89c4f0df (diff) | |
download | cowboy-1eb2bda3041ccc87690d74087011074db6699147.tar.gz cowboy-1eb2bda3041ccc87690d74087011074db6699147.tar.bz2 cowboy-1eb2bda3041ccc87690d74087011074db6699147.zip |
Merge branch 'rest-content-type' of git://github.com/dvv/cowboy
Diffstat (limited to 'src/cowboy_rest.erl')
-rw-r--r-- | src/cowboy_rest.erl | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/cowboy_rest.erl b/src/cowboy_rest.erl index 526f102..40baabb 100644 --- a/src/cowboy_rest.erl +++ b/src/cowboy_rest.erl @@ -776,9 +776,12 @@ accept_resource(Req, State, OnTrue) -> {CTA, Req2, HandlerState} -> CTA2 = [normalize_content_types(P) || P <- CTA], State2 = State#state{handler_state=HandlerState}, - {ok, ContentType, Req3} - = cowboy_req:parse_header(<<"content-type">>, Req2), - choose_content_type(Req3, State2, OnTrue, ContentType, CTA2) + case cowboy_req:parse_header(<<"content-type">>, Req2) of + {ok, ContentType, Req3} -> + choose_content_type(Req3, State2, OnTrue, ContentType, CTA2); + {error, badarg} -> + respond(Req2, State2, 415) + end end. %% The special content type '*' will always match. It can be used as a |