From 0d8fd6c7e22ad1744f9626fb90b015bf22224a9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 8 Jun 2017 15:02:04 +0200 Subject: cow_multipart:from_data/1 doesn't return transfer-encoding anymore That header is deprecated in the context of HTTP. --- src/cow_multipart.erl | 13 +++---------- 1 file 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]. -- cgit v1.2.3