From c966076bbeea5911843f188e418330f939566b20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Sat, 26 Apr 2014 17:34:56 +0200 Subject: Add a test for multipart over chunked transfer-encoding --- test/http_SUITE.erl | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test') diff --git a/test/http_SUITE.erl b/test/http_SUITE.erl index 4e4c058..35d4b06 100644 --- a/test/http_SUITE.erl +++ b/test/http_SUITE.erl @@ -485,6 +485,28 @@ multipart(Config) -> ], ok. +multipart_chunked(Config) -> + ConnPid = gun_open(Config), + Body = << + "This is a preamble." + "\r\n--OHai\r\nX-Name:answer\r\n\r\n42" + "\r\n--OHai\r\nServer:Cowboy\r\n\r\nIt rocks!\r\n" + "\r\n--OHai--\r\n" + "This is an epilogue." + >>, + Ref = gun:post(ConnPid, "/multipart", [ + {<<"content-type">>, <<"multipart/x-makes-no-sense; boundary=OHai">>}, + {<<"transfer-encoding">>, <<"chunked">>}]), + gun:data(ConnPid, Ref, fin, Body), + {response, nofin, 200, _} = gun:await(ConnPid, Ref), + {ok, RespBody} = gun:await_body(ConnPid, Ref), + Parts = binary_to_term(RespBody), + Parts = [ + {[{<<"x-name">>, <<"answer">>}], <<"42">>}, + {[{<<"server">>, <<"Cowboy">>}], <<"It rocks!\r\n">>} + ], + ok. + multipart_large(Config) -> ConnPid = gun_open(Config), Boundary = "----------", -- cgit v1.2.3