diff options
author | Loïc Hoguin <[email protected]> | 2014-04-26 17:34:56 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2014-04-26 17:34:56 +0200 |
commit | c966076bbeea5911843f188e418330f939566b20 (patch) | |
tree | 2c584d363f8cb949418d8e433462cba4ff4c93bb /test/http_SUITE.erl | |
parent | da29d8138dcc14c1b02b303c9b3da4a6135b985c (diff) | |
download | cowboy-c966076bbeea5911843f188e418330f939566b20.tar.gz cowboy-c966076bbeea5911843f188e418330f939566b20.tar.bz2 cowboy-c966076bbeea5911843f188e418330f939566b20.zip |
Add a test for multipart over chunked transfer-encoding
Diffstat (limited to 'test/http_SUITE.erl')
-rw-r--r-- | test/http_SUITE.erl | 22 |
1 files changed, 22 insertions, 0 deletions
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 = "----------", |