mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 20:30:23 +00:00
Add a test for multipart over chunked transfer-encoding
This commit is contained in:
parent
da29d8138d
commit
c966076bbe
1 changed files with 22 additions and 0 deletions
|
@ -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 = "----------",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue