Skip to content

Instantly share code, notes, and snippets.

@178inaba
Created November 23, 2016 06:33
Show Gist options
  • Save 178inaba/a428496ebdc31edd16c84e78103d45ac to your computer and use it in GitHub Desktop.
Save 178inaba/a428496ebdc31edd16c84e78103d45ac to your computer and use it in GitHub Desktop.
Print header with golang.
package main
import (
"net/http"
log "github.com/Sirupsen/logrus"
"github.com/gin-gonic/gin"
)
func main() {
r := gin.Default()
r.GET("/", func(c *gin.Context) {
for k, vals := range c.Request.Header {
log.Infof("%s", k)
for _, v := range vals {
log.Infof("\t%s", v)
}
}
c.Status(http.StatusNoContent)
})
r.Run()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment