feat(core): add HTTP/2 response path

This commit is contained in:
Zakaria El Orche
2026-08-13 18:04:22 +00:00
parent cfa192e689
commit 9391f80f76
20 changed files with 1684 additions and 663 deletions
+16
View File
@@ -300,6 +300,22 @@ tests and local development. It's a no-op in production beyond a single `boolean
`req.body()`/`RequestBody` follows the same rule — materialise (`.bytes()`) or fully consume
(`.stream()`) it inside the handler; don't stash the `RequestBody` itself for later.
### Reusable response headers
Use `PreEncodedHeader` for a constant header sent by many responses. It stores the name and value
once and remains valid on both HTTP versions:
```java
private static final PreEncodedHeader NO_STORE =
new PreEncodedHeader("cache-control", "no-store");
app.get("/health", (req, res) -> res.header(NO_STORE).body("ok"));
```
`Response.header(byte[])` accepts a complete CRLF-terminated HTTP/1 field line and is therefore
HTTP/1-only; HPACK needs the name and value as separate fields. Prefer `PreEncodedHeader` for shared
application and middleware code.
## Architecture
```