Add form handler
Some checks are pending
test / test (push) Waiting to run

This commit is contained in:
Em (Ethan) Ruszanowski 2024-07-23 17:14:25 -04:00
parent 02ee76a2ed
commit ce3fa95b54
Signed by: em
GPG key ID: C725D6E571252B96

View file

@ -33,7 +33,6 @@ pub fn main() {
) )
["echo"] -> echo_body(req) ["echo"] -> echo_body(req)
["chunk"] -> serve_chunk(req) ["chunk"] -> serve_chunk(req)
["file", ..rest] -> serve_file(req, rest)
["form"] -> handle_form(req) ["form"] -> handle_form(req)
_ -> not_found _ -> not_found
@ -96,3 +95,9 @@ fn serve_chunk(_request: Request(Connection)) -> Response(ResponseData) {
|> response.set_body(mist.Chunked(iter)) |> response.set_body(mist.Chunked(iter))
|> response.set_header("content-type", "text/plain") |> 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()))
}