@zhin.js/host-http 1.1.13 → 1.1.15

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/src/http-host.ts CHANGED
@@ -350,6 +350,8 @@ export function createHttpHost(options: HttpHostOptions = {}): ProcessHttpHost {
350
350
  if (corsOk && origin) applyCors(response, origin, corsOrigins);
351
351
  writeJson(response, auth.forbidden ? 403 : 401, {
352
352
  success: false,
353
+ code: auth.forbidden ? 'forbidden' : 'unauthorized',
354
+ requestOutcome: 'not-dispatched',
353
355
  error: auth.forbidden ? 'Token scope does not allow this route' : 'Invalid or missing token',
354
356
  });
355
357
  return;
@@ -368,8 +370,7 @@ export function createHttpHost(options: HttpHostOptions = {}): ProcessHttpHost {
368
370
  response.setHeader('X-Frame-Options', 'SAMEORIGIN');
369
371
  const release = route.admission?.acquire();
370
372
  if (route.admission && !release) {
371
- response.writeHead(503);
372
- response.end();
373
+ writeJson(response, 503, { success: false, code: 'unavailable', requestOutcome: 'not-dispatched' });
373
374
  return;
374
375
  }
375
376
  if (!release) {