GetRequestHeader
从HTTP请求头中获取相应的值。
Example
package main
import (
"github.com/vicanso/elton"
"github.com/vicanso/elton/middleware"
)
func main() {
e := elton.New()
e.Use(middleware.NewDefaultResponder())
e.GET("/", func(c *elton.Context) (err error) {
c.Body = c.GetRequestHeader("User-Agent")
return
})
err := e.ListenAndServe(":3000")
if err != nil {
panic(err)
}
}