diff --git a/src/webtest.gleam b/src/webtest.gleam index 21558c8..b8b24eb 100644 --- a/src/webtest.gleam +++ b/src/webtest.gleam @@ -4,6 +4,7 @@ import gleam/erlang/process import gleam/http import gleam/http/request.{type Request} import gleam/http/response.{type Response} +import gleam/int import gleam/io import gleam/iterator import gleam/option.{None, Some} @@ -84,3 +85,14 @@ fn echo_body(request: Request(Connection)) -> Response(ResponseData) { |> response.set_body(mist.Bytes(bytes_builder.new())) }) } + +fn serve_chunk(_request: Request(Connection)) -> Response(ResponseData) { + let iter = + ["one", "two", "three"] + |> iterator.from_list + |> iterator.map(bytes_builder.from_string) + + response.new(200) + |> response.set_body(mist.Chunked(iter)) + |> response.set_header("content-type", "text/plain") +}