diff options
author | Loïc Hoguin <[email protected]> | 2017-09-04 20:48:07 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2017-09-04 20:48:07 +0200 |
commit | 4fd6e2f7cdca1c1adf1ba0bd76a0702328c380f4 (patch) | |
tree | b644857e9b4134f2db67b936b29fa2456af48dfb /test/handlers/resp_h.erl | |
parent | 0995fc99e039ea0b6b2979801c2ab1e0eb05a910 (diff) | |
download | cowboy-4fd6e2f7cdca1c1adf1ba0bd76a0702328c380f4.tar.gz cowboy-4fd6e2f7cdca1c1adf1ba0bd76a0702328c380f4.tar.bz2 cowboy-4fd6e2f7cdca1c1adf1ba0bd76a0702328c380f4.zip |
Accept sendfile tuple with 0 length in cowboy_req
This will result in no data being sent. It's simply easier to
do this than to have to handle 0 size cases in user code.
Diffstat (limited to 'test/handlers/resp_h.erl')
-rw-r--r-- | test/handlers/resp_h.erl | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/test/handlers/resp_h.erl b/test/handlers/resp_h.erl index 694f04a..9b94e3f 100644 --- a/test/handlers/resp_h.erl +++ b/test/handlers/resp_h.erl @@ -58,6 +58,9 @@ do(<<"resp_headers_empty">>, Req, Opts) -> do(<<"set_resp_body">>, Req0, Opts) -> Arg = cowboy_req:binding(arg, Req0), Req1 = case Arg of + <<"sendfile0">> -> + AppFile = code:where_is_file("cowboy.app"), + cowboy_req:set_resp_body({sendfile, 0, 0, AppFile}, Req0); <<"sendfile">> -> AppFile = code:where_is_file("cowboy.app"), cowboy_req:set_resp_body({sendfile, 0, filelib:file_size(AppFile), AppFile}, Req0); |