Skip to content

Commit 51f908a

Browse files
committed
Allow apps to access the MS-Author-Via header
This is used by rdflib to detect whether it can send PUT requests. Since it removed a hack (see linkeddata/rdflib.js#359) it can now no longer detect whether a Document is editable.
1 parent 9fefd08 commit 51f908a

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

lib/create-app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const corsSettings = cors({
3131
methods: [
3232
'OPTIONS', 'HEAD', 'GET', 'PATCH', 'POST', 'PUT', 'DELETE'
3333
],
34-
exposedHeaders: 'Authorization, User, Location, Link, Vary, Last-Modified, ETag, Accept-Patch, Accept-Post, Updates-Via, Allow, WAC-Allow, Content-Length, WWW-Authenticate',
34+
exposedHeaders: 'Authorization, User, Location, Link, Vary, Last-Modified, ETag, Accept-Patch, Accept-Post, Updates-Via, Allow, WAC-Allow, Content-Length, WWW-Authenticate, MS-Author-Via',
3535
credentials: true,
3636
maxAge: 1728000,
3737
origin: true,

lib/handlers/cors-proxy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const validUrl = require('valid-url')
1111

1212
const CORS_SETTINGS = {
1313
methods: 'GET',
14-
exposedHeaders: 'Authorization, User, Location, Link, Vary, Last-Modified, Content-Length, Content-Location',
14+
exposedHeaders: 'Authorization, User, Location, Link, Vary, Last-Modified, Content-Length, Content-Location, MS-Author-Via',
1515
maxAge: 1728000,
1616
origin: true
1717
}

test/integration/header-test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ describe('Header handler', () => {
2020
request = supertest(server)
2121
})
2222

23+
describe('MS-Author-Via', () => {
24+
describeHeaderTest('read/append for the public', {
25+
resource: '/public-ra',
26+
headers: {
27+
'MS-Author-Via': 'SPARQL',
28+
'Access-Control-Expose-Headers': /(^|,\s*)MS-Author-Via(,|$)/
29+
}
30+
})
31+
})
32+
2333
describe('WAC-Allow', () => {
2434
describeHeaderTest('read/append for the public', {
2535
resource: '/public-ra',

test/integration/http-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ describe('HTTP APIs', function () {
106106
.expect('Access-Control-Allow-Origin', 'http://example.com')
107107
.expect('Access-Control-Allow-Credentials', 'true')
108108
.expect('Access-Control-Allow-Methods', 'OPTIONS,HEAD,GET,PATCH,POST,PUT,DELETE')
109-
.expect('Access-Control-Expose-Headers', 'Authorization, User, Location, Link, Vary, Last-Modified, ETag, Accept-Patch, Accept-Post, Updates-Via, Allow, WAC-Allow, Content-Length, WWW-Authenticate')
109+
.expect('Access-Control-Expose-Headers', 'Authorization, User, Location, Link, Vary, Last-Modified, ETag, Accept-Patch, Accept-Post, Updates-Via, Allow, WAC-Allow, Content-Length, WWW-Authenticate, MS-Author-Via')
110110
.expect(204, done)
111111
})
112112

0 commit comments

Comments
 (0)