From ce3fa95b54b5f6f32e804e9e992f8a30cb6425eb Mon Sep 17 00:00:00 2001 From: Ethan Ruszanowski Date: Tue, 23 Jul 2024 17:14:25 -0400 Subject: [PATCH] Add form handler --- src/webtest.gleam | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/webtest.gleam b/src/webtest.gleam index b8b24eb..d0747a7 100644 --- a/src/webtest.gleam +++ b/src/webtest.gleam @@ -33,7 +33,6 @@ pub fn main() { ) ["echo"] -> echo_body(req) ["chunk"] -> serve_chunk(req) - ["file", ..rest] -> serve_file(req, rest) ["form"] -> handle_form(req) _ -> not_found @@ -96,3 +95,9 @@ fn serve_chunk(_request: Request(Connection)) -> Response(ResponseData) { |> response.set_body(mist.Chunked(iter)) |> response.set_header("content-type", "text/plain") } + +fn handle_form(req: Request(Connection)) -> Response(ResponseData) { + let _req = mist.read_body(req, 1024 * 1024 * 30) + response.new(200) + |> response.set_body(mist.Bytes(bytes_builder.new())) +}