feat: Handle OPTIONS requests in OperationHandler

This commit is contained in:
Joachim Van Herwegen
2022-03-17 15:34:03 +01:00
parent 6f83ac5ead
commit ad3edcf1a8
10 changed files with 110 additions and 13 deletions

View File

@@ -21,12 +21,13 @@ interface SimpleCorsOptions {
/**
* Handler that sets CORS options on the response.
* In case of an OPTIONS request this handler will close the connection after adding its headers.
* In case of an OPTIONS request this handler will close the connection after adding its headers
* if `preflightContinue` is set to `false`.
*
* 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
* Solid, §8.1: "A server 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 server,
* and the Solid app can read any response and response headers received from the server."
* Full details: https://solidproject.org/TR/2021/protocol-20211217#cors-server
*/
export class CorsHandler extends HttpHandler {
private readonly corsHandler: (