aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_req.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-01-22 14:00:05 +0100
committerLoïc Hoguin <[email protected]>2018-01-22 14:00:05 +0100
commit3a7b411143db08cb4d8813d00988c07848738bd3 (patch)
treeb30a00bb1b06d3f784e4be867a1b6e7f088ffb70 /src/cowboy_req.erl
parent82cd22a88b3f87064d9f17e36652b104b709a679 (diff)
downloadcowboy-3a7b411143db08cb4d8813d00988c07848738bd3.tar.gz
cowboy-3a7b411143db08cb4d8813d00988c07848738bd3.tar.bz2
cowboy-3a7b411143db08cb4d8813d00988c07848738bd3.zip
Don't crash in delete_resp_header if no resp headers are set
Diffstat (limited to 'src/cowboy_req.erl')
-rw-r--r--src/cowboy_req.erl5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cowboy_req.erl b/src/cowboy_req.erl
index 552f409..bae5e78 100644
--- a/src/cowboy_req.erl
+++ b/src/cowboy_req.erl
@@ -688,7 +688,10 @@ has_resp_body(_) ->
-spec delete_resp_header(binary(), Req)
-> Req when Req::req().
delete_resp_header(Name, Req=#{resp_headers := RespHeaders}) ->
- Req#{resp_headers => maps:remove(Name, RespHeaders)}.
+ Req#{resp_headers => maps:remove(Name, RespHeaders)};
+%% There are no resp headers so we have nothing to delete.
+delete_resp_header(Name, Req) ->
+ Req.
-spec inform(cowboy:http_status(), req()) -> ok.
inform(Status, Req) ->