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 Mar 26, 2024
1 parent 3455bab commit d45c76e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
erlang 26.2.2
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 d45c76e

Please sign in to comment.