api: Sent ErrPreconditionFailed on If-Match failure (#2009)

* api: Sent ErrPreconditionFailed on If-Match failure

ref:
http://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#ErrorCodeList

* tests: Added functional tests for GetObject w/ If-Match headers set

* tests: Used verifyError to simplify errorCode and description matching on error
This commit is contained in:
Krishnan Parthasarathi
2016-06-28 01:18:18 -07:00
committed by Harshavardhana
parent 76f6533f8d
commit a854e8cc5c
3 changed files with 78 additions and 1 deletions

View File

@@ -74,6 +74,7 @@ const (
ErrNoSuchKey
ErrNoSuchUpload
ErrNotImplemented
ErrPreconditionFailed
ErrRequestTimeTooSkewed
ErrSignatureDoesNotMatch
ErrMethodNotAllowed
@@ -255,6 +256,11 @@ var errorCodeResponse = map[APIErrorCode]APIError{
Description: "A header you provided implies functionality that is not implemented.",
HTTPStatusCode: http.StatusNotImplemented,
},
ErrPreconditionFailed: {
Code: "PreconditionFailed",
Description: "At least one of the preconditions you specified did not hold.",
HTTPStatusCode: http.StatusPreconditionFailed,
},
ErrRequestTimeTooSkewed: {
Code: "RequestTimeTooSkewed",
Description: "The difference between the request time and the server's time is too large.",