Constantize string
This commit is contained in:
parent
ca53ce1081
commit
45f6fe3bf1
|
@ -24,6 +24,7 @@ const (
|
||||||
jsonContentType = "application/json"
|
jsonContentType = "application/json"
|
||||||
contentType = "Content-Type"
|
contentType = "Content-Type"
|
||||||
jsonSuffix = ".json"
|
jsonSuffix = ".json"
|
||||||
|
authorization = "Authorization"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -124,7 +125,7 @@ func (register *Registry) YieldProtectedExporter(username, password string) http
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
authenticated := false
|
authenticated := false
|
||||||
|
|
||||||
if auth := r.Header.Get("Authorization"); auth != "" {
|
if auth := r.Header.Get(authorization); auth != "" {
|
||||||
base64Encoded := strings.SplitAfter(auth, " ")[1]
|
base64Encoded := strings.SplitAfter(auth, " ")[1]
|
||||||
decoded, err := base64.URLEncoding.DecodeString(base64Encoded)
|
decoded, err := base64.URLEncoding.DecodeString(base64Encoded)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|
Loading…
Reference in New Issue