Skip to content

Commit 58e319d

Browse files
authored
Merge pull request #1682 from solid/revert-1623-update/remove-ms-author-via
Revert "Remove the MS-Author-Via header" This is temporary see #1683
2 parents 6ffedc6 + 7e0a5ec commit 58e319d

File tree

7 files changed

+17
-3
lines changed

7 files changed

+17
-3
lines changed

lib/create-app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const corsSettings = cors({
3232
methods: [
3333
'OPTIONS', 'HEAD', 'GET', 'PATCH', 'POST', 'PUT', 'DELETE'
3434
],
35-
exposedHeaders: 'Authorization, User, Location, Link, Vary, Last-Modified, ETag, Accept-Patch, Accept-Post, Updates-Via, Allow, WAC-Allow, Content-Length, WWW-Authenticate, X-Powered-By',
35+
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, X-Powered-By',
3636
credentials: true,
3737
maxAge: 1728000,
3838
origin: true,

lib/handlers/cors-proxy.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const validUrl = require('valid-url')
1313

1414
const CORS_SETTINGS = {
1515
methods: 'GET',
16-
exposedHeaders: 'Authorization, User, Location, Link, Vary, Last-Modified, Content-Length, Content-Location, X-Powered-By',
16+
exposedHeaders: 'Authorization, User, Location, Link, Vary, Last-Modified, Content-Length, Content-Location, MS-Author-Via, X-Powered-By',
1717
maxAge: 1728000,
1818
origin: true
1919
}

lib/handlers/get.js

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ async function handler (req, res, next) {
2727
const requestedType = negotiator.mediaType()
2828
const possibleRDFType = negotiator.mediaType(RDFs)
2929

30+
res.header('MS-Author-Via', 'SPARQL')
31+
3032
// Set live updates
3133
if (ldp.live) {
3234
res.header('Updates-Via', ldp.resourceMapper.resolveUrl(req.hostname).replace(/^http/, 'ws'))

lib/handlers/patch.js

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const DEFAULT_FOR_NEW_CONTENT_TYPE = 'text/turtle'
2323
// Handles a PATCH request
2424
async function patchHandler (req, res, next) {
2525
debug(`PATCH -- ${req.originalUrl}`)
26+
res.header('MS-Author-Via', 'SPARQL')
2627
try {
2728
// Obtain details of the target resource
2829
const ldp = req.app.locals.ldp

lib/handlers/put.js

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const { stringToStream } = require('../utils')
88

99
async function handler (req, res, next) {
1010
debug(req.originalUrl)
11+
res.header('MS-Author-Via', 'SPARQL')
1112

1213
const contentType = req.get('content-type')
1314
if (isAuxiliary(req)) {

test/integration/header-test.js

+10
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ describe('HTTP APIs', function () {
110110
.expect('Access-Control-Allow-Origin', 'http://example.com')
111111
.expect('Access-Control-Allow-Credentials', 'true')
112112
.expect('Access-Control-Allow-Methods', 'OPTIONS,HEAD,GET,PATCH,POST,PUT,DELETE')
113-
.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, X-Powered-By')
113+
.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, X-Powered-By')
114114
.expect(204, done)
115115
})
116116

0 commit comments

Comments
 (0)