Last active
April 6, 2018 16:46
-
-
Save adamv/98cc6e6a6c14ae5585ff196f87e2eaeb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"net/http" | |
) | |
func firstOrDefault(r *http.Request, key string, defaultValue string) string { | |
first := r.Header.Get(key) | |
if first != "" { | |
return first | |
} | |
return defaultValue | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment