Constantize string

This commit is contained in:
Daniel Bornkessel 2013-01-09 12:47:33 +01:00
parent ca53ce1081
commit 45f6fe3bf1
1 changed files with 2 additions and 1 deletions

View File

@ -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 {