mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: Handle OPTIONS requests in OperationHandler
This commit is contained in:
@@ -70,7 +70,7 @@ describe('An http server with middleware', (): void => {
|
||||
.set('Access-Control-Request-Headers', 'content-type')
|
||||
.set('Access-Control-Request-Method', 'POST')
|
||||
.set('Host', 'test.com')
|
||||
.expect(204);
|
||||
.expect(200);
|
||||
expect(res.header).toEqual(expect.objectContaining({
|
||||
'access-control-allow-origin': '*',
|
||||
'access-control-allow-headers': 'content-type',
|
||||
|
||||
@@ -44,10 +44,9 @@ const allModes = [ AM.read, AM.append, AM.create, AM.write, AM.delete ];
|
||||
// For PUT/PATCH/DELETE we return 205 instead of 200/204
|
||||
/* eslint-disable no-multi-spaces */
|
||||
const table: [string, string, AM[], AM[] | undefined, string, string, number, number][] = [
|
||||
// We currently handle OPTIONS before authorization
|
||||
// [ 'OPTIONS', 'C/R', [], undefined, '', '', 401, 401 ],
|
||||
// [ 'OPTIONS', 'C/R', [], [ AM.read ], '', '', 200, 404 ],
|
||||
// [ 'OPTIONS', 'C/R', [ AM.read ], undefined, '', '', 200, 404 ],
|
||||
[ 'OPTIONS', 'C/R', [], undefined, '', '', 401, 401 ],
|
||||
[ 'OPTIONS', 'C/R', [], [ AM.read ], '', '', 204, 404 ],
|
||||
[ 'OPTIONS', 'C/R', [ AM.read ], undefined, '', '', 204, 404 ],
|
||||
|
||||
[ 'HEAD', 'C/R', [], undefined, '', '', 401, 401 ],
|
||||
[ 'HEAD', 'C/R', [], [ AM.read ], '', '', 200, 404 ],
|
||||
|
||||
Reference in New Issue
Block a user