[#484] Handle conditional headers
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
ee0f3fb196
commit
f282e877e2
3 changed files with 24 additions and 9 deletions
|
@ -38,6 +38,7 @@ type (
|
|||
PartNumberMarker int
|
||||
Attributes []string
|
||||
VersionID string
|
||||
Conditional *conditionalArgs
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -90,6 +91,11 @@ func (h *handler) GetObjectAttributesHandler(w http.ResponseWriter, r *http.Requ
|
|||
return
|
||||
}
|
||||
|
||||
if err = checkPreconditions(info, params.Conditional); err != nil {
|
||||
h.logAndSendError(w, "precondition failed", reqInfo, err)
|
||||
return
|
||||
}
|
||||
|
||||
response, err := encodeToObjectAttributesResponse(info, params)
|
||||
if err != nil {
|
||||
h.logAndSendError(w, "couldn't encode object info to response", reqInfo, err)
|
||||
|
@ -152,7 +158,8 @@ func parseGetObjectAttributeArgs(r *http.Request) (*GetObjectAttributesArgs, err
|
|||
|
||||
res.VersionID = queryValues.Get(api.QueryVersionID)
|
||||
|
||||
return res, nil
|
||||
res.Conditional, err = parseConditionalHeaders(r.Header)
|
||||
return res, err
|
||||
}
|
||||
|
||||
func encodeToObjectAttributesResponse(info *data.ObjectInfo, p *GetObjectAttributesArgs) (*GetObjectAttributesResponse, error) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue