@ultimat3/http 27.2.2 → 27.3.0

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.
Files changed (2) hide show
  1. package/package.json +5 -5
  2. package/src/server.ts +10 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultimat3/http",
3
- "version": "27.2.2",
3
+ "version": "27.3.0",
4
4
  "description": "Owned request lifecycle over Bun.serve: router, ordered pipeline, problem+json errors",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -35,9 +35,9 @@
35
35
  "test": "bun test"
36
36
  },
37
37
  "dependencies": {
38
- "@ultimat3/core": "27.2.2",
39
- "@ultimat3/i18n": "27.2.2",
40
- "@ultimat3/schema": "27.2.2",
41
- "@ultimat3/time": "27.2.2"
38
+ "@ultimat3/core": "27.3.0",
39
+ "@ultimat3/i18n": "27.3.0",
40
+ "@ultimat3/schema": "27.3.0",
41
+ "@ultimat3/time": "27.3.0"
42
42
  }
43
43
  }
package/src/server.ts CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  import type { DrainConfig, HealthPayload, HealthState, Role } from '@ultimat3/core';
6
6
  import {
7
+ BUILD_ID_HEADER,
7
8
  beginWork,
8
9
  configureLifecycle,
9
10
  drain,
@@ -220,6 +221,8 @@ const buildServer = (options: ServerOptions, releaseStore: () => void): ServerHa
220
221
  *
221
222
  * The STATUS is everyone's, which is all a probe reads. The body beyond the verdict is for a
222
223
  * peer `healthDetailPeers` lists: these two paths answer outside the pipeline, unauthenticated.
224
+ * The build id rides in the HEADER, as on every page the `context` stage stamps (#734): a deploy
225
+ * check asks `/readyz` which build answers, and the body stays the stranger's verdict (#53).
223
226
  */
224
227
  const healthResponse = (payload: HealthPayload, request: Request, socket: BunServer): Response =>
225
228
  jsonResponse(
@@ -232,7 +235,13 @@ const buildServer = (options: ServerOptions, releaseStore: () => void): ServerHa
232
235
  socketAddress: socket.requestIP(request)?.address ?? null,
233
236
  }),
234
237
  ),
235
- { status: payload.status, headers: { 'cache-control': 'no-store' } },
238
+ {
239
+ status: payload.status,
240
+ headers: {
241
+ 'cache-control': 'no-store',
242
+ ...(config.buildId === null ? {} : { [BUILD_ID_HEADER]: config.buildId }),
243
+ },
244
+ },
236
245
  );
237
246
 
238
247
  const dispatch = async (request: Request, socket?: BunServer): Promise<Response> => {