this is attainable in JS too. The ServiceWorkers spec has you instantiating Response types that have status, headers, and a body which can be an opaque-to-js stream
Ohh, interesting! What kind of middleware are you referring to? The concept of extractors still lives on inside the Context argument. E.g. ctx.body_json() can convert the incoming body stream to a typed struct. And it can be extended with custom impls! Or is that different?
-
-
Hm, it's tricky (I'm still new to Rust so it might not translate!) In spife there's a middleware list; each mw can provide "lifecycle" functions – for "startup", "incoming request", and "handler accessed request body data". That last one is on `request.body` access.
-
The goal was to decouple "My application wants structured data" from "The framework knows how to decode the underlying request format" – the handler doesn't know if it's talking JSON, multipart, tarball, etc & doesn't care. Middleware can handle that (& fail with a 400 if not)
- 4 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
