Skip to content

Commit a69da13

Browse files
committed
replace res.sendStatus with res.status and update tests
1 parent d7b7bd9 commit a69da13

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

lib/handlers/patch.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ async function patchHandler (req, res, next) {
9191
return writeGraph(graph, resource, ldp.resourceMapper.resolveFilePath(req.hostname), ldp.serverUri)
9292
})
9393

94-
// Send the result to the client
95-
res.sendStatus(resourceExists ? 200 : 201)
94+
// Send the status and result to the client
95+
res.status(resourceExists ? 200 : 201)
9696
res.send(result)
9797
} catch (err) {
9898
return next(err)

test/integration/acl-oidc-test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ describe('ACL with WebID+OIDC over HTTP', function () {
557557
options.headers['content-type'] = 'application/sparql-update'
558558
request.patch(options, function (error, response, body) {
559559
assert.equal(error, null)
560-
assert.equal(response.statusCode, 200)
560+
assert.equal(response.statusCode, 201)
561561
done()
562562
})
563563
})
@@ -616,7 +616,7 @@ describe('ACL with WebID+OIDC over HTTP', function () {
616616
options.headers['content-type'] = 'application/sparql-update'
617617
request.patch(options, function (error, response, body) {
618618
assert.equal(error, null)
619-
assert.equal(response.statusCode, 200)
619+
assert.equal(response.statusCode, 201)
620620
done()
621621
})
622622
})

test/integration/patch-sparql-update-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('PATCH through application/sparql-update', function () {
2222
server.patch('/notExisting.ttl')
2323
.set('content-type', 'application/sparql-update')
2424
.send('INSERT DATA { :test :hello 456 .}')
25-
.expect(200)
25+
.expect(201)
2626
.end(function (err, res, body) {
2727
assert.equal(
2828
read('sampleContainer/notExisting.ttl'),

test/integration/patch-test.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ describe('PATCH through text/n3', () => {
7979
patch: `<> a solid:InsertDeletePatch;
8080
solid:inserts { <x> <y> <z>. }.`
8181
}, { // expected:
82-
status: 200,
82+
status: 201,
8383
text: 'Patch applied successfully',
8484
result: '@prefix : </new.ttl#>.\n@prefix tim: </>.\n\ntim:x tim:y tim:z.\n\n'
8585
}))
@@ -90,7 +90,7 @@ describe('PATCH through text/n3', () => {
9090
patch: `<> a solid:InsertDeletePatch;
9191
solid:inserts { <x> <y> <z>. }.`
9292
}, { // expected:
93-
status: 200,
93+
status: 201,
9494
text: 'Patch applied successfully',
9595
// result: '{\n "@id": "/x",\n "/y": {\n "@id": "/z"\n }\n}'
9696
result: `{
@@ -110,7 +110,7 @@ describe('PATCH through text/n3', () => {
110110
patch: `<> a solid:InsertDeletePatch;
111111
solid:inserts { <x> <y> <z>. }.`
112112
}, { // expected:
113-
status: 200,
113+
status: 201,
114114
text: 'Patch applied successfully',
115115
result: `<rdf:RDF
116116
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
@@ -126,7 +126,7 @@ describe('PATCH through text/n3', () => {
126126
patch: `<> a solid:InsertDeletePatch;
127127
solid:inserts { <x> <y> <z>. }.`
128128
}, { // expected:
129-
status: 200,
129+
status: 201,
130130
text: 'Patch applied successfully',
131131
result: '@prefix : </new.n3#>.\n@prefix tim: </>.\n\ntim:x tim:y tim:z.\n\n'
132132
}))
@@ -186,7 +186,7 @@ describe('PATCH through text/n3', () => {
186186
patch: `<> a solid:InsertDeletePatch;
187187
solid:inserts { <x> <y> <z>. }.`
188188
}, {
189-
status: 200,
189+
status: 201,
190190
text: 'Patch applied successfully',
191191
result: '@prefix : <#>.\n@prefix fol: <./>.\n\nfol:x fol:y fol:z.\n\n'
192192
}))

0 commit comments

Comments
 (0)