rest-vir - v1.0.0
    Preparing search index...

    Function handleCors

    • Determines the required origin for the endpoint and compares it with the given request.

      If an OPTIONS request is being handled, a NoContent response is always sent, with all CORS headers set appropriately.

      For other requests:

      • If the request fails the origin checks, a Forbidden response is sent.
      • If the request passes origin checks, the appropriate CORS headers are set and a response is not sent (so further handlers can process it).

      Parameters

      • this: void
      • __namedParameters: Readonly<
            SelectFrom<
                EndpointHandlerParams,
                {
                    request: { headers: true; method: true; originalUrl: true };
                    route: {
                        isEndpoint: true;
                        isWebSocket: true;
                        methods: true;
                        path: true;
                        requiredClientOrigin: true;
                        service: {
                            customHeaders: true;
                            logger: true;
                            requiredClientOrigin: true;
                            serviceName: true;
                        };
                    };
                },
            >,
        >

      Returns Promise<HandledOutput>