diff --git a/auth.go b/auth.go index 4d7a163..6e06781 100644 --- a/auth.go +++ b/auth.go @@ -29,7 +29,7 @@ var ( ) // 需要校验的 Headers 列表 -var needSignHeaders = map[string]bool{ +var NeedSignHeaders = map[string]bool{ "host": true, "range": true, "x-cos-acl": true, @@ -65,6 +65,10 @@ var ciParameters = map[string]bool{ "imageview2/": true, } +func SetNeedSignHeaders(key string, val bool) { + NeedSignHeaders[key] = val +} + func safeURLEncode(s string) string { s = encodeURIComponent(s) s = strings.Replace(s, "!", "%21", -1) @@ -275,7 +279,7 @@ func isCIParameter(key string) bool { } func isSignHeader(key string) bool { - for k, v := range needSignHeaders { + for k, v := range NeedSignHeaders { if key == k && v { return true }