Skip to content

Commit 3e6db72

Browse files
committed
Merge branch 'issue#1743' into 5.7.9-alpha
2 parents 0185d3c + e17beb8 commit 3e6db72

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

lib/handlers/patch.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ async function patchHandler (req, res, next) {
6969
patch.text = req.body ? req.body.toString() : ''
7070
patch.uri = `${url}#patch-${hash(patch.text)}`
7171
patch.contentType = getContentType(req.headers)
72+
if (!patch.contentType) {
73+
throw error(400, 'PATCH request requires a content-type via the Content-Type header')
74+
}
7275
debug('PATCH -- Received patch (%d bytes, %s)', patch.text.length, patch.contentType)
7376
const parsePatch = PATCH_PARSERS[patch.contentType]
7477
if (!parsePatch) {

lib/ldp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ class LDP {
350350
}
351351
}
352352
if (testName) {
353-
throw error(404, `${testPath}: Container and resource cannot have the same name in URI`)
353+
throw error(409, `${testPath}: Container and resource cannot have the same name in URI`)
354354
}
355355
}
356356

test/integration/http-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,15 +557,15 @@ describe('HTTP APIs', function () {
557557
// .set('content-type', 'text/turtle')
558558
// .expect(hasHeader('describedBy', suffixMeta))
559559
// .expect(hasHeader('acl', suffixAcl))
560-
.expect(404, done)
560+
.expect(409, done)
561561
})
562562
it('should not create new resource if a folder/resource with same name will exist in tree', function (done) {
563563
server.put('/foo/bar/baz/baz1/test.ttl')
564564
.send(putRequestBody)
565565
.set('content-type', 'text/turtle')
566566
.expect(hasHeader('describedBy', 'test.ttl' + suffixMeta))
567567
.expect(hasHeader('acl', 'test.ttl' + suffixAcl))
568-
.expect(404, done)
568+
.expect(409, done)
569569
})
570570
it('should return 201 when trying to put to a container without content-type',
571571
function (done) {

0 commit comments

Comments
 (0)