Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix charset not working properly for REST

  • Loading branch information...
commit 08a4975c3467e236473445954181804c339bac34 1 parent 6d4e157
Loïc Hoguin essen authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/cowboy_rest.erl
6 src/cowboy_rest.erl
View
@@ -40,7 +40,7 @@
language_a :: undefined | binary(),
%% Charset.
- charsets_p = [] :: [binary()],
+ charsets_p = [] :: [{binary(), integer()}],
charset_a :: undefined | binary(),
%% Cached resource calls.
@@ -373,7 +373,7 @@ charsets_provided(Req, State) ->
case AcceptCharset of
undefined ->
set_content_type(Req3, State2#state{
- charset_a=hd(CP)});
+ charset_a=element(1, hd(CP))});
AcceptCharset ->
AcceptCharset2 = prioritize_charsets(AcceptCharset),
choose_charset(Req3, State2, AcceptCharset2)
@@ -403,7 +403,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).
Please sign in to comment.
Something went wrong with that request. Please try again.