mirror of
https://github.com/minio/minio.git
synced 2025-11-07 21:02:58 -05:00
PostForm: Follow success_action_status requirement (#3467)
S3 spec requires that Post Object response depends on the passed success_action_status. This commit implements that requirement.
This commit is contained in:
committed by
Harshavardhana
parent
1875a47495
commit
4692fdbb8f
@@ -448,11 +448,22 @@ func (api objectAPIHandlers) PostPolicyBucketHandler(w http.ResponseWriter, r *h
|
||||
w.Header().Set("ETag", "\""+objInfo.MD5Sum+"\"")
|
||||
w.Header().Set("Location", getObjectLocation(bucket, object))
|
||||
|
||||
// Set common headers.
|
||||
setCommonHeaders(w)
|
||||
// Decide what http response to send depending on success_action_status parameter
|
||||
switch formValues[http.CanonicalHeaderKey("success_action_status")] {
|
||||
case "201":
|
||||
resp := encodeResponse(PostResponse{
|
||||
Bucket: bucket,
|
||||
Key: object,
|
||||
ETag: "\"" + objInfo.MD5Sum + "\"",
|
||||
Location: getObjectLocation(bucket, object),
|
||||
})
|
||||
writeResponse(w, http.StatusCreated, resp)
|
||||
|
||||
// Write successful response.
|
||||
writeSuccessNoContent(w)
|
||||
case "200":
|
||||
writeSuccessResponse(w, nil)
|
||||
default:
|
||||
writeSuccessNoContent(w)
|
||||
}
|
||||
|
||||
// Notify object created event.
|
||||
eventNotify(eventData{
|
||||
|
||||
Reference in New Issue
Block a user