mirror of
https://github.com/minio/minio.git
synced 2024-12-25 14:45:54 -05:00
Remove duplicate http constants (#5367)
This commit is contained in:
parent
1de3bd6911
commit
dae8193bd4
@ -58,13 +58,14 @@ func isRequestPresignedSignatureV2(r *http.Request) bool {
|
|||||||
|
|
||||||
// Verify if request has AWS Post policy Signature Version '4'.
|
// Verify if request has AWS Post policy Signature Version '4'.
|
||||||
func isRequestPostPolicySignatureV4(r *http.Request) bool {
|
func isRequestPostPolicySignatureV4(r *http.Request) bool {
|
||||||
return strings.Contains(r.Header.Get("Content-Type"), "multipart/form-data") && r.Method == httpPOST
|
return strings.Contains(r.Header.Get("Content-Type"), "multipart/form-data") &&
|
||||||
|
r.Method == http.MethodPost
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify if the request has AWS Streaming Signature Version '4'. This is only valid for 'PUT' operation.
|
// Verify if the request has AWS Streaming Signature Version '4'. This is only valid for 'PUT' operation.
|
||||||
func isRequestSignStreamingV4(r *http.Request) bool {
|
func isRequestSignStreamingV4(r *http.Request) bool {
|
||||||
return r.Header.Get("x-amz-content-sha256") == streamingContentSHA256 &&
|
return r.Header.Get("x-amz-content-sha256") == streamingContentSHA256 &&
|
||||||
r.Method == httpPUT
|
r.Method == http.MethodPut
|
||||||
}
|
}
|
||||||
|
|
||||||
// Authorization type.
|
// Authorization type.
|
||||||
|
@ -229,7 +229,7 @@ func setBrowserCacheControlHandler(h http.Handler) http.Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (h cacheControlHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
func (h cacheControlHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.Method == httpGET && guessIsBrowserReq(r) && globalIsBrowserEnabled {
|
if r.Method == http.MethodGet && guessIsBrowserReq(r) && globalIsBrowserEnabled {
|
||||||
// For all browser requests set appropriate Cache-Control policies
|
// For all browser requests set appropriate Cache-Control policies
|
||||||
if hasPrefix(r.URL.Path, minioReservedBucketPath+"/") {
|
if hasPrefix(r.URL.Path, minioReservedBucketPath+"/") {
|
||||||
if hasSuffix(r.URL.Path, ".js") || r.URL.Path == minioReservedBucketPath+"/favicon.ico" {
|
if hasSuffix(r.URL.Path, ".js") || r.URL.Path == minioReservedBucketPath+"/favicon.ico" {
|
||||||
@ -341,24 +341,14 @@ type resourceHandler struct {
|
|||||||
handler http.Handler
|
handler http.Handler
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of http methods.
|
|
||||||
const (
|
|
||||||
httpGET = "GET"
|
|
||||||
httpPUT = "PUT"
|
|
||||||
httpHEAD = "HEAD"
|
|
||||||
httpPOST = "POST"
|
|
||||||
httpDELETE = "DELETE"
|
|
||||||
httpOPTIONS = "OPTIONS"
|
|
||||||
)
|
|
||||||
|
|
||||||
// List of default allowable HTTP methods.
|
// List of default allowable HTTP methods.
|
||||||
var defaultAllowableHTTPMethods = []string{
|
var defaultAllowableHTTPMethods = []string{
|
||||||
httpGET,
|
http.MethodGet,
|
||||||
httpPUT,
|
http.MethodPut,
|
||||||
httpHEAD,
|
http.MethodHead,
|
||||||
httpPOST,
|
http.MethodPost,
|
||||||
httpDELETE,
|
http.MethodDelete,
|
||||||
httpOPTIONS,
|
http.MethodOptions,
|
||||||
}
|
}
|
||||||
|
|
||||||
// setCorsHandler handler for CORS (Cross Origin Resource Sharing)
|
// setCorsHandler handler for CORS (Cross Origin Resource Sharing)
|
||||||
|
Loading…
Reference in New Issue
Block a user