mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
16 lines
335 B
Erlang
16 lines
335 B
Erlang
![]() |
%% This module reads the request body fully and send a 204 response.
|
||
|
|
||
|
-module(read_body_h).
|
||
|
|
||
|
-export([init/2]).
|
||
|
|
||
|
init(Req0, Opts) ->
|
||
|
{ok, Req} = read_body(Req0),
|
||
|
{ok, cowboy_req:reply(200, #{}, Req), Opts}.
|
||
|
|
||
|
read_body(Req0) ->
|
||
|
case cowboy_req:read_body(Req0) of
|
||
|
{ok, _, Req} -> {ok, Req};
|
||
|
{more, _, Req} -> read_body(Req)
|
||
|
end.
|