diff options
author | Loïc Hoguin <[email protected]> | 2017-10-30 16:21:25 +0000 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2017-10-30 16:21:25 +0000 |
commit | 217fac7f4414f5ff5eda85079a179e2462aba61c (patch) | |
tree | 9493f8a7df840ffb9d971ec3015aeb0586e9aae4 /test/handlers | |
parent | f3d6b05b863fe177a34a8a6ba48c5f263ef8cf82 (diff) | |
download | cowboy-217fac7f4414f5ff5eda85079a179e2462aba61c.tar.gz cowboy-217fac7f4414f5ff5eda85079a179e2462aba61c.tar.bz2 cowboy-217fac7f4414f5ff5eda85079a179e2462aba61c.zip |
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).
Diffstat (limited to 'test/handlers')
-rw-r--r-- | test/handlers/echo_h.erl | 3 |
1 files changed, 3 insertions, 0 deletions
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) |