summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2021-09-11 22:37:23 +0200
committerMiloslav Trmač <mitr@redhat.com>2021-12-10 18:16:20 +0100
commit2946e83493e2628c68819357ebc15bada38d45b5 (patch)
tree96a8344440e9369b1d1b2f7e528ec04c686f2c5f
parent1ecc6ba72852700f748715124bdf98573cc93c0b (diff)
downloadpodman-2946e83493e2628c68819357ebc15bada38d45b5.tar.gz
podman-2946e83493e2628c68819357ebc15bada38d45b5.tar.bz2
podman-2946e83493e2628c68819357ebc15bada38d45b5.zip
Beautify GetCredentials.has a bit
Use separate lines, and use the provided .String() API. Should not change behaivor. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
-rw-r--r--pkg/auth/auth.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/auth/auth.go b/pkg/auth/auth.go
index 3ecdd99fe..8e4cb6959 100644
--- a/pkg/auth/auth.go
+++ b/pkg/auth/auth.go
@@ -33,7 +33,10 @@ const XRegistryConfigHeader HeaderAuthName = "X-Registry-Config"
// GetCredentials queries the http.Request for X-Registry-.* headers and extracts
// the necessary authentication information for libpod operations
func GetCredentials(r *http.Request) (*types.DockerAuthConfig, string, error) {
- has := func(key HeaderAuthName) bool { hdr, found := r.Header[string(key)]; return found && len(hdr) > 0 }
+ has := func(key HeaderAuthName) bool {
+ hdr, found := r.Header[key.String()]
+ return found && len(hdr) > 0
+ }
switch {
case has(XRegistryConfigHeader):
c, f, err := getConfigCredentials(r)