From ec00e3d60e985e00c6b425434af5017c634801db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Fri, 9 Jun 2017 16:57:11 +0200 Subject: Make cowboy_req:read_part return multipart headers as map --- test/req_SUITE.erl | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'test/req_SUITE.erl') diff --git a/test/req_SUITE.erl b/test/req_SUITE.erl index a2c040e..d155aa8 100644 --- a/test/req_SUITE.erl +++ b/test/req_SUITE.erl @@ -399,14 +399,13 @@ do_multipart(Path, Config) -> {<<"content-type">>, <<"multipart/mixed; boundary=deadbeef">>} ], ReqBody, Config), [ - {[{<<"content-type">>, <<"text/plain">>}], <<"Cowboy is an HTTP server.">>}, + {#{<<"content-type">> := <<"text/plain">>}, <<"Cowboy is an HTTP server.">>}, {LargeHeaders, LargeBody} ] = binary_to_term(RespBody), - %% @todo Multipart header order is currently undefined. - [ - {<<"content-type">>, <<"application/octet-stream">>}, - {<<"x-custom">>, <<"value">>} - ] = lists:sort(LargeHeaders), + #{ + <<"content-type">> := <<"application/octet-stream">>, + <<"x-custom">> := <<"value">> + } = LargeHeaders, ok. read_part_skip_body(Config) -> @@ -421,14 +420,13 @@ read_part_skip_body(Config) -> {<<"content-type">>, <<"multipart/mixed; boundary=deadbeef">>} ], ReqBody, Config), [ - [{<<"content-type">>, <<"text/plain">>}], + #{<<"content-type">> := <<"text/plain">>}, LargeHeaders ] = binary_to_term(RespBody), - %% @todo Multipart header order is currently undefined. - [ - {<<"content-type">>, <<"application/octet-stream">>}, - {<<"x-custom">>, <<"value">>} - ] = lists:sort(LargeHeaders), + #{ + <<"content-type">> := <<"application/octet-stream">>, + <<"x-custom">> := <<"value">> + } = LargeHeaders, ok. %% @todo When reading a multipart body, length and period -- cgit v1.2.3