It would be helpful if smol included a way to consume responses, since only requests are consumable via smol.read_* functions.
Specific use case I had was writing tests for an API in order to make sure that its behavior does not change over time and thus does not break the clients, for example:
pub fn error_test() {
use resp <- promise.await(handler.error(
400,
dict.from_list([#("message", "reason")]),
))
should.equal(400, resp.status)
should.be_ok(list.find(resp.headers, is.json))
is.equal(resp, "{\"errors\":{\"message\":\"reason\"}}")
}
resp is of type smol.Response(smol.ReadableStream) and I'm comparing it directly to expected string for convenience.
Thank you!