0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 12:20:24 +00:00

Don't crash in delete_resp_header if no resp headers are set

This commit is contained in:
Loïc Hoguin 2018-01-22 14:00:05 +01:00
parent 82cd22a88b
commit 3a7b411143
No known key found for this signature in database
GPG key ID: 8A9DF795F6FED764
2 changed files with 11 additions and 5 deletions

View file

@ -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) ->