@zudojs/http 1.4.0 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -83,8 +83,9 @@ answers 502 and never exposes the cause.
83
83
  UUID is generated, so an id copied into logs can never carry spaces,
84
84
  quotes or control characters. `createNodeHttpAdapter({ trustRequestId:
85
85
  false })` always generates one. The request guard's own `X-Request-Id`
86
- check (letters, digits, `_`, `-`) still answers 400 to a malformed header
87
- first unless it is tuned or turned off.
86
+ check uses the same character set and length, so an id the adapter would
87
+ reuse is never refused first; anything else is answered with 400 unless the
88
+ guard is tuned or turned off.
88
89
  - Signed-cookie signatures are compared with `@zudojs/crypto`'s constant-time
89
90
  `timingSafeEqualString`.
90
91
  - Contexts built by the stock adapters log through a `@zudojs/logger` console
@@ -8,7 +8,7 @@ import { HttpRequestContext as RequestContext } from "../../httpRequest/httpRequ
8
8
  import { HttpResponseContext as ResponseContext } from "../../httpResponse/httpResponse.context.js";
9
9
  import { isWebResponse, webResponseToContext, } from "../../httpResponse/httpResponse.fromWeb.js";
10
10
  import { HttpMiddlewareError } from "../httpMiddleware.error.js";
11
- import { guardResponseToContext } from "./httpPipeline.guardResponse.js";
11
+ import { applyGuardResponse, guardResponseToContext, } from "./httpPipeline.guardResponse.js";
12
12
  export async function nextResult(context, dispatch, index) {
13
13
  return dispatch(index + 1);
14
14
  }
@@ -32,7 +32,12 @@ export function normalizeResult(result, fallback) {
32
32
  * were a response context.
33
33
  */
34
34
  if (isGuardResponse(result)) {
35
- return guardResponseToContext(result);
35
+ // Written onto the ambient response when there is one, so headers an
36
+ // outer middleware set before `next()` (CORS, request id, security
37
+ // headers) survive a refusal, as they do on the router path.
38
+ return fallback instanceof ResponseContext
39
+ ? applyGuardResponse(fallback, result)
40
+ : guardResponseToContext(result);
36
41
  }
37
42
  /*
38
43
  * The `Response` check must come first. `isResponseContext` tests for a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zudojs/http",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "description": "HTTP primitives, request handling, routing, middleware, and server infrastructure for Zudojs applications.",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -26,14 +26,14 @@
26
26
  "dependencies": {
27
27
  "@zudojs/crypto": "1.3.1",
28
28
  "@zudojs/errors": "1.3.0",
29
- "@zudojs/logger": "1.4.0",
29
+ "@zudojs/logger": "1.4.1",
30
30
  "@zudojs/middleware": "1.1.0",
31
31
  "@zudojs/openapi": "1.5.0",
32
- "@zudojs/security": "1.3.0"
32
+ "@zudojs/security": "1.3.1"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/node": "^26.6.2",
36
- "@zudojs/schema": "1.2.0",
36
+ "@zudojs/schema": "1.2.1",
37
37
  "fluent-ffmpeg": "^2.1.3",
38
38
  "sharp": "^0.35.4",
39
39
  "typescript": "7.0.2",