diff options
author | Loïc Hoguin <[email protected]> | 2017-06-08 15:02:04 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2017-06-08 15:08:10 +0200 |
commit | 0d8fd6c7e22ad1744f9626fb90b015bf22224a9c (patch) | |
tree | 4135cd06ee41027050d5327097dcd5a6c1f38a2c | |
parent | 1df21130122cc42f593f34a3984734f6f9ad5095 (diff) | |
download | cowlib-0d8fd6c7e22ad1744f9626fb90b015bf22224a9c.tar.gz cowlib-0d8fd6c7e22ad1744f9626fb90b015bf22224a9c.tar.bz2 cowlib-0d8fd6c7e22ad1744f9626fb90b015bf22224a9c.zip |
cow_multipart:from_data/1 doesn't return transfer-encoding anymore
That header is deprecated in the context of HTTP.
-rw-r--r-- | src/cow_multipart.erl | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/cow_multipart.erl b/src/cow_multipart.erl index e86afcc..0c5027f 100644 --- a/src/cow_multipart.erl +++ b/src/cow_multipart.erl @@ -525,7 +525,7 @@ horse_build() -> -spec form_data(headers()) -> {data, binary()} - | {file, binary(), binary(), binary(), binary()}. + | {file, binary(), binary(), binary()}. form_data(Headers) -> {_, DispositionBin} = lists:keyfind(<<"content-disposition">>, 1, Headers), {<<"form-data">>, Params} = parse_content_disposition(DispositionBin), @@ -538,13 +538,7 @@ form_data(Headers) -> false -> <<"text/plain">>; {_, T} -> T end, - %% @todo Turns out this is unnecessary per RFC7578 4.7. - TransferEncoding = case lists:keyfind( - <<"content-transfer-encoding">>, 1, Headers) of - false -> <<"7bit">>; - {_, TE} -> TE - end, - {file, FieldName, Filename, Type, TransferEncoding} + {file, FieldName, Filename, Type} end. -ifdef(TEST). @@ -555,8 +549,7 @@ form_data_test_() -> {[{<<"content-disposition">>, <<"form-data; name=\"files\"; filename=\"file1.txt\"">>}, {<<"content-type">>, <<"text/x-plain">>}], - {file, <<"files">>, <<"file1.txt">>, - <<"text/x-plain">>, <<"7bit">>}} + {file, <<"files">>, <<"file1.txt">>, <<"text/x-plain">>}} ], [{lists:flatten(io_lib:format("~p", [V])), fun() -> R = form_data(V) end} || {V, R} <- Tests]. |