Skip to content
This repository has been archived by the owner on Aug 25, 2023. It is now read-only.

Commit

Permalink
fix #137, still requires unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
michielbdejong committed Aug 9, 2019
1 parent d665998 commit d8102d1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/lib/api/http/HttpResponder.ts
Expand Up @@ -10,6 +10,7 @@ export enum ResultType {
CouldNotParse,
AccessDenied,
PreconditionFailed,
PreconditionRequired,
NotModified,
NotFound,
QuotaExceeded,
Expand Down Expand Up @@ -62,6 +63,11 @@ const responses: Responses = {
responseBody: 'Precondition failed',
constrainedBy: 'conflict'
},
[ResultType.PreconditionFailed]: {
responseStatus: 428,
responseBody: 'Precondition required',
constrainedBy: 'precondition-required'
},
[ResultType.NotFound]: {
responseStatus: 404,
responseBody: 'Not found',
Expand Down
2 changes: 1 addition & 1 deletion src/lib/operationHandlers/writeBlobHandler.ts
Expand Up @@ -23,7 +23,7 @@ export const writeBlobHandler = {
debug('checking If-Match presence', ifMatchHeaderPresent, task.ifMatch(), task.ifNoneMatchStar(), task.ifMatchRequired, blobExists)
if (blobExists || (task.ifMatchRequired && !ifMatchHeaderPresent)) {
debug('attempt to overwrite existing resource')
throw new ErrorResult(ResultType.PreconditionFailed)
throw new ErrorResult(ResultType.PreconditionRequired)
}
const resultType = (blobExists ? ResultType.OkayWithoutBody : ResultType.Created)
const contentType: string | undefined = task.contentType()
Expand Down

0 comments on commit d8102d1

Please sign in to comment.