@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/lib/console-rest-pages-helpers.d.ts +23 -0
- package/lib/console-rest-pages-helpers.js +570 -0
- package/lib/console-rest-pages.js +10 -570
- package/lib/console-rpc-handlers.d.ts +21 -0
- package/lib/console-rpc-handlers.js +659 -0
- package/lib/console-rpc.d.ts +9 -5
- package/lib/console-rpc.js +91 -584
- package/lib/http-host.js +3 -2
- package/package.json +4 -4
- package/src/console-rest-pages-helpers.ts +619 -0
- package/src/console-rest-pages.ts +12 -612
- package/src/console-rpc-handlers.ts +608 -0
- package/src/console-rpc.ts +82 -556
- package/src/http-host.ts +3 -2
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
|
|
372
|
-
response.end();
|
|
373
|
+
writeJson(response, 503, { success: false, code: 'unavailable', requestOutcome: 'not-dispatched' });
|
|
373
374
|
return;
|
|
374
375
|
}
|
|
375
376
|
if (!release) {
|