Skip to content

Commit

Permalink
Merge branch 'issue#1743' into 5.7.9-alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
bourgeoa committed Dec 26, 2023
2 parents 0185d3c + e17beb8 commit 3e6db72
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions lib/handlers/patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ async function patchHandler (req, res, next) {
patch.text = req.body ? req.body.toString() : ''
patch.uri = `${url}#patch-${hash(patch.text)}`
patch.contentType = getContentType(req.headers)
if (!patch.contentType) {
throw error(400, 'PATCH request requires a content-type via the Content-Type header')
}
debug('PATCH -- Received patch (%d bytes, %s)', patch.text.length, patch.contentType)
const parsePatch = PATCH_PARSERS[patch.contentType]
if (!parsePatch) {
Expand Down
2 changes: 1 addition & 1 deletion lib/ldp.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ class LDP {
}
}
if (testName) {
throw error(404, `${testPath}: Container and resource cannot have the same name in URI`)
throw error(409, `${testPath}: Container and resource cannot have the same name in URI`)
}
}

Expand Down
4 changes: 2 additions & 2 deletions test/integration/http-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -557,15 +557,15 @@ describe('HTTP APIs', function () {
// .set('content-type', 'text/turtle')
// .expect(hasHeader('describedBy', suffixMeta))
// .expect(hasHeader('acl', suffixAcl))
.expect(404, done)
.expect(409, done)
})
it('should not create new resource if a folder/resource with same name will exist in tree', function (done) {
server.put('/foo/bar/baz/baz1/test.ttl')
.send(putRequestBody)
.set('content-type', 'text/turtle')
.expect(hasHeader('describedBy', 'test.ttl' + suffixMeta))
.expect(hasHeader('acl', 'test.ttl' + suffixAcl))
.expect(404, done)
.expect(409, done)
})
it('should return 201 when trying to put to a container without content-type',
function (done) {
Expand Down

0 comments on commit 3e6db72

Please sign in to comment.