From 217fac7f4414f5ff5eda85079a179e2462aba61c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 30 Oct 2017 16:21:25 +0000 Subject: Handle expect: 100-continue request headers The 100 continue response will only be sent if the client has not sent the body yet (at all), if the connection is HTTP/1.1 or above and if the user has not sent it yet. The 100 continue response is sent when the user calls read_body and it is cowboy_stream_h's responsibility to send it. This means projects that don't use the cowboy_stream_h stream handler will need to handle the expect header themselves (but that's okay because they might have different considerations than normal Cowboy). --- test/handlers/echo_h.erl | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test/handlers/echo_h.erl') diff --git a/test/handlers/echo_h.erl b/test/handlers/echo_h.erl index b7a407b..18bdbe6 100644 --- a/test/handlers/echo_h.erl +++ b/test/handlers/echo_h.erl @@ -18,6 +18,9 @@ echo(<<"read_body">>, Req0, Opts) -> _ -> ok end, {_, Body, Req} = case cowboy_req:path(Req0) of + <<"/100-continue", _/bits>> -> + cowboy_req:inform(100, Req0), + cowboy_req:read_body(Req0); <<"/full", _/bits>> -> read_body(Req0, <<>>); <<"/opts", _/bits>> -> cowboy_req:read_body(Req0, Opts); _ -> cowboy_req:read_body(Req0) -- cgit v1.2.3