Created
April 17, 2017 19:18
-
-
Save wpjunior/7412e7c6f105d51acf3effddc85c48ca to your computer and use it in GitHub Desktop.
Echo all HTTP Headers
This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "net/http" | |
| ) | |
| type blah struct{} | |
| func (b *blah) ServeHTTP(w http.ResponseWriter, r *http.Request) { | |
| for key, value := range r.Header { | |
| fmt.Fprintf(w, "Temos o header: %s, com valor %s\n", key, value) | |
| } | |
| } | |
| func main() { | |
| log.Fatal(http.ListenAndServe(":8888", &blah{})) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment