Skip to content

Instantly share code, notes, and snippets.

@wpjunior
Created April 17, 2017 19:18
Show Gist options
  • Select an option

  • Save wpjunior/7412e7c6f105d51acf3effddc85c48ca to your computer and use it in GitHub Desktop.

Select an option

Save wpjunior/7412e7c6f105d51acf3effddc85c48ca to your computer and use it in GitHub Desktop.
Echo all HTTP Headers
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