Header
返回HTTP响应头。
Example
package main
import (
"math/rand"
"strconv"
"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.SetHeader("X-Response-Id", strconv.Itoa(rand.Int()))
c.Body = c.Header()
return
})
err := e.ListenAndServe(":3000")
if err != nil {
panic(err)
}
}