Options
All
  • Public
  • Public/Protected
  • All
Menu

Handler that sets CORS options on the response. In case of an OPTIONS request this handler will close the connection after adding its headers.

Solid, ยง7.1: "A data pod MUST implement the CORS protocol [FETCH] such that, to the extent possible, the browser allows Solid apps to send any request and combination of request headers to the data pod, and the Solid app can read any response and response headers received from the data pod." Full details: https://solid.github.io/specification/protocol#cors-server

Hierarchy

Index

Constructors

constructor

  • new CorsHandler(options?: SimpleCorsOptions): CorsHandler

Properties

Private Readonly corsHandler

corsHandler: (req: CorsRequest, res: { statusCode?: number; end: any; setHeader: any }, next: (err?: any) => any) => void

Type declaration

    • (req: CorsRequest, res: { statusCode?: number; end: any; setHeader: any }, next: (err?: any) => any): void
    • Parameters

      • req: CorsRequest
      • res: { statusCode?: number; end: any; setHeader: any }
      • next: (err?: any) => any
          • (err?: any): any
          • Parameters

            • Optional err: any

            Returns any

      Returns void

Methods

canHandle

  • Checks if the input can be handled by this class. If it cannot handle the input, rejects with an error explaining why.

    Parameters

    Returns Promise<void>

    A promise resolving if the input can be handled, rejecting with an Error if not.

handle

handleSafe