mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-16 13:10:24 +00:00
Add 'Accept-Language' to cowboy_http_req:parse_header/2
This commit is contained in:
parent
3e443f0a6c
commit
6dbe2b2130
2 changed files with 99 additions and 13 deletions
|
@ -203,6 +203,7 @@ parse_header(Name, Req=#http_req{p_headers=PHeaders}) ->
|
|||
parse_header_default('Accept') -> [];
|
||||
parse_header_default('Accept-Charset') -> [];
|
||||
parse_header_default('Accept-Encoding') -> [];
|
||||
parse_header_default('Accept-Language') -> [];
|
||||
parse_header_default('Connection') -> [];
|
||||
parse_header_default(_Name) -> undefined.
|
||||
|
||||
|
@ -226,6 +227,11 @@ parse_header(Name, Req, Default) when Name =:= 'Accept-Encoding' ->
|
|||
fun (Value) ->
|
||||
cowboy_http:list(Value, fun cowboy_http:conneg/2)
|
||||
end);
|
||||
parse_header(Name, Req, Default) when Name =:= 'Accept-Language' ->
|
||||
parse_header(Name, Req, Default,
|
||||
fun (Value) ->
|
||||
cowboy_http:nonempty_list(Value, fun cowboy_http:language_range/2)
|
||||
end);
|
||||
parse_header(Name, Req, Default) when Name =:= 'Connection' ->
|
||||
parse_header(Name, Req, Default,
|
||||
fun (Value) ->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue