From 4fd6e2f7cdca1c1adf1ba0bd76a0702328c380f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 4 Sep 2017 20:48:07 +0200 Subject: 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. --- test/handlers/resp_h.erl | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test/handlers') 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); -- cgit v1.2.3