Created
November 23, 2016 06:33
-
-
Save 178inaba/a428496ebdc31edd16c84e78103d45ac to your computer and use it in GitHub Desktop.
Print header with golang.
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 ( | |
"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