Skip to content

Commit 399308c

Browse files
committed
missing Accept-Patch/Accept-Post headers
1 parent 83dad06 commit 399308c

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

lib/handlers/get.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,12 @@ async function handler (req, res, next) {
2727
const requestedType = negotiator.mediaType()
2828
const possibleRDFType = negotiator.mediaType(RDFs)
2929

30+
// deprecated kept for compatibility
3031
res.header('MS-Author-Via', 'SPARQL')
3132

33+
res.header('Accept-Patch', 'text/n3, application/sparql-update, application/sparql-update-single-match')
34+
res.header('Accept-Post', '*/*')
35+
3236
// Set live updates
3337
if (ldp.live) {
3438
res.header('Updates-Via', ldp.resourceMapper.resolveUrl(req.hostname).replace(/^http/, 'ws'))

test/integration/header-test.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('Header handler', () => {
2020
request = supertest(server)
2121
})
2222

23-
describe('MS-Author-Via', () => {
23+
describe('MS-Author-Via', () => { // deprecated
2424
describeHeaderTest('read/append for the public', {
2525
resource: '/public-ra',
2626
headers: {
@@ -30,6 +30,16 @@ describe('Header handler', () => {
3030
})
3131
})
3232

33+
describe('Accept-Patch', () => {
34+
describeHeaderTest('read/append for the public', {
35+
resource: '/public-ra',
36+
headers: {
37+
'Accept-Patch': 'text/n3, application/sparql-update, application/sparql-update-single-match',
38+
'Access-Control-Expose-Headers': /(^|,\s*)Accept-Patch(,|$)/
39+
}
40+
})
41+
})
42+
3343
describe('WAC-Allow', () => {
3444
describeHeaderTest('read/append for the public', {
3545
resource: '/public-ra',

test/integration/patch-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const serverOptions = {
2222
forceUser: `${serverUri}/profile/card#me`
2323
}
2424

25-
describe('PATCH', () => {
25+
describe('PATCH through text/n3', () => {
2626
let request
2727
let server
2828

0 commit comments

Comments
 (0)