refactor: Rename resourceExists to hasResource

The function was also moved to the smaller interface ResourceSet.
This commit is contained in:
Joachim Van Herwegen
2022-02-23 15:41:31 +01:00
parent 2ae5924dde
commit 4404fa07d9
26 changed files with 73 additions and 64 deletions

View File

@@ -42,7 +42,7 @@ export class PatchOperationHandler extends OperationHandler {
// RFC7231, §4.3.4: If the target resource does not have a current representation and the
// PUT successfully creates one, then the origin server MUST inform the
// user agent by sending a 201 (Created) response.
const exists = await this.store.resourceExists(operation.target, operation.conditions);
const exists = await this.store.hasResource(operation.target);
await this.store.modifyResource(operation.target, operation.body as Patch, operation.conditions);
if (exists) {
return new ResetResponseDescription();

View File

@@ -38,7 +38,7 @@ export class PutOperationHandler extends OperationHandler {
}
// A more efficient approach would be to have the server return metadata indicating if a resource was new
// See https://github.com/solid/community-server/issues/632
const exists = await this.store.resourceExists(operation.target, operation.conditions);
const exists = await this.store.hasResource(operation.target);
await this.store.setRepresentation(operation.target, operation.body, operation.conditions);
if (exists) {
return new ResetResponseDescription();