mirror of
https://github.com/minio/minio.git
synced 2025-11-09 13:39:46 -05:00
api: Set appropriate content-type for success/error responses. (#3537)
Golang HTTP client automatically detects content-type but for S3 clients this content-type might be incorrect or might misbehave. For example: ``` Content-Type: text/xml; charset=utf-8 ``` Should be ``` Content-Type: application/xml ``` Allow this to be set properly.
This commit is contained in:
@@ -59,7 +59,7 @@ func checkCopyObjectPreconditions(w http.ResponseWriter, r *http.Request, objInf
|
||||
if !ifModifiedSince(objInfo.ModTime, ifModifiedSinceHeader) {
|
||||
// If the object is not modified since the specified time.
|
||||
writeHeaders()
|
||||
writeErrorResponse(w, r, ErrPreconditionFailed, r.URL.Path)
|
||||
writeErrorResponse(w, ErrPreconditionFailed, r.URL)
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ func checkCopyObjectPreconditions(w http.ResponseWriter, r *http.Request, objInf
|
||||
if ifModifiedSince(objInfo.ModTime, ifUnmodifiedSinceHeader) {
|
||||
// If the object is modified since the specified time.
|
||||
writeHeaders()
|
||||
writeErrorResponse(w, r, ErrPreconditionFailed, r.URL.Path)
|
||||
writeErrorResponse(w, ErrPreconditionFailed, r.URL)
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -83,7 +83,7 @@ func checkCopyObjectPreconditions(w http.ResponseWriter, r *http.Request, objInf
|
||||
if objInfo.MD5Sum != "" && !isETagEqual(objInfo.MD5Sum, ifMatchETagHeader) {
|
||||
// If the object ETag does not match with the specified ETag.
|
||||
writeHeaders()
|
||||
writeErrorResponse(w, r, ErrPreconditionFailed, r.URL.Path)
|
||||
writeErrorResponse(w, ErrPreconditionFailed, r.URL)
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -95,7 +95,7 @@ func checkCopyObjectPreconditions(w http.ResponseWriter, r *http.Request, objInf
|
||||
if objInfo.MD5Sum != "" && isETagEqual(objInfo.MD5Sum, ifNoneMatchETagHeader) {
|
||||
// If the object ETag matches with the specified ETag.
|
||||
writeHeaders()
|
||||
writeErrorResponse(w, r, ErrPreconditionFailed, r.URL.Path)
|
||||
writeErrorResponse(w, ErrPreconditionFailed, r.URL)
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -152,7 +152,7 @@ func checkPreconditions(w http.ResponseWriter, r *http.Request, objInfo ObjectIn
|
||||
if ifModifiedSince(objInfo.ModTime, ifUnmodifiedSinceHeader) {
|
||||
// If the object is modified since the specified time.
|
||||
writeHeaders()
|
||||
writeErrorResponse(w, r, ErrPreconditionFailed, r.URL.Path)
|
||||
writeErrorResponse(w, ErrPreconditionFailed, r.URL)
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -164,7 +164,7 @@ func checkPreconditions(w http.ResponseWriter, r *http.Request, objInfo ObjectIn
|
||||
if !isETagEqual(objInfo.MD5Sum, ifMatchETagHeader) {
|
||||
// If the object ETag does not match with the specified ETag.
|
||||
writeHeaders()
|
||||
writeErrorResponse(w, r, ErrPreconditionFailed, r.URL.Path)
|
||||
writeErrorResponse(w, ErrPreconditionFailed, r.URL)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user