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

add clause for processing given headers

This commit is contained in:
geeksilva97 2024-03-26 01:05:16 -03:00
parent 05509c6c4b
commit c6491b82a8

View file

@ -726,9 +726,14 @@ set_resp_header(Name, Value, Req=#{resp_headers := RespHeaders}) ->
set_resp_header(Name,Value, Req) ->
Req#{resp_headers => #{Name => Value}}.
% @todo process headers list - reduce to a map and concat the values of repeated headers, except for set-cookie that will be treated differently
% @todo define the correct spec
-spec set_resp_headers_list(list(term()), req())
set_resp_headers_list(List, Req) ->
ok.
set_resp_headers_list([], Req) ->
Req;
set_resp_headers_list([{Name, Value} | Headers], Req) ->
Req1 = set_resp_header(Name, Value, Req),
set_resp_headers_list(Headers, Req1).
-spec set_resp_headers(cowboy:http_headers(), Req)
-> Req when Req::req().