diff options
author | Loïc Hoguin <[email protected]> | 2014-12-16 10:57:11 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2014-12-16 10:57:11 +0200 |
commit | a5c1a88378596b5efdd9ed40ebcc78f24844f1ed (patch) | |
tree | a03177aa8cf91b7fb734490a90a3800940273866 /src/cow_http_hd.erl | |
parent | e7d8b3cf66cb1b4b352b440e913993b7e10f6e3d (diff) | |
download | cowlib-a5c1a88378596b5efdd9ed40ebcc78f24844f1ed.tar.gz cowlib-a5c1a88378596b5efdd9ed40ebcc78f24844f1ed.tar.bz2 cowlib-a5c1a88378596b5efdd9ed40ebcc78f24844f1ed.zip |
Add a property for cow_http_hd:parse_transfer_encoding/1
Diffstat (limited to 'src/cow_http_hd.erl')
-rw-r--r-- | src/cow_http_hd.erl | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/cow_http_hd.erl b/src/cow_http_hd.erl index a66ba70..046b3e4 100644 --- a/src/cow_http_hd.erl +++ b/src/cow_http_hd.erl @@ -1037,7 +1037,7 @@ parse_max_forwards_error_test_() -> %% @doc Parse the Transfer-Encoding header. %% -%% @todo Extension parameters. +%% @todo This function does not support parsing of transfer-parameter. -spec parse_transfer_encoding(binary()) -> [binary()]. parse_transfer_encoding(<<"chunked">>) -> @@ -1046,6 +1046,16 @@ parse_transfer_encoding(TransferEncoding) -> nonempty(token_ci_list(TransferEncoding, [])). -ifdef(TEST). +prop_parse_transfer_encoding() -> + ?FORALL(L, + non_empty(list(token())), + begin + << _, TransferEncoding/binary >> = iolist_to_binary([[$,, C] || C <- L]), + ResL = parse_transfer_encoding(TransferEncoding), + CheckedL = [?INLINE_LOWERCASE_BC(Co) =:= ResC || {Co, ResC} <- lists:zip(L, ResL)], + [true] =:= lists:usort(CheckedL) + end). + parse_transfer_encoding_test_() -> Tests = [ {<<"a , , , ">>, [<<"a">>]}, |