Skip to content

Commit

Permalink
add clause for processing given headers
Browse files Browse the repository at this point in the history
  • Loading branch information
geeksilva97 committed Apr 19, 2024
1 parent 05509c6 commit c6491b8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/cowboy_req.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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().
Expand Down

0 comments on commit c6491b8

Please sign in to comment.