mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 20:30:23 +00:00
charsets_provided/2 returns a list of charsets
It incorrectly returned a tuple containing the charset and an associated quality which wasn't being used.
This commit is contained in:
parent
1d413ea51b
commit
08fcb38a18
1 changed files with 3 additions and 4 deletions
|
@ -45,7 +45,7 @@
|
|||
language_a :: undefined | binary(),
|
||||
|
||||
%% Charset.
|
||||
charsets_p = [] :: [{binary(), integer()}],
|
||||
charsets_p = [] :: [binary()],
|
||||
charset_a :: undefined | binary(),
|
||||
|
||||
%% Whether the resource exists.
|
||||
|
@ -406,8 +406,7 @@ charsets_provided(Req, State) ->
|
|||
cowboy_req:parse_header(<<"accept-charset">>, Req2),
|
||||
case AcceptCharset of
|
||||
undefined ->
|
||||
set_content_type(Req3, State2#state{
|
||||
charset_a=element(1, hd(CP))});
|
||||
set_content_type(Req3, State2#state{charset_a=hd(CP)});
|
||||
AcceptCharset ->
|
||||
AcceptCharset2 = prioritize_charsets(AcceptCharset),
|
||||
choose_charset(Req3, State2, AcceptCharset2)
|
||||
|
@ -437,7 +436,7 @@ choose_charset(Req, State=#state{charsets_p=CP}, [Charset|Tail]) ->
|
|||
|
||||
match_charset(Req, State, Accept, [], _Charset) ->
|
||||
choose_charset(Req, State, Accept);
|
||||
match_charset(Req, State, _Accept, [{Provided, _}|_], {Provided, _}) ->
|
||||
match_charset(Req, State, _Accept, [Provided|_], {Provided, _}) ->
|
||||
set_content_type(Req, State#state{charset_a=Provided});
|
||||
match_charset(Req, State, Accept, [_|Tail], Charset) ->
|
||||
match_charset(Req, State, Accept, Tail, Charset).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue