AddHeader
添加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.AddHeader("X-Response-Id", "1")
c.AddHeader("X-Response-Id", "2")
c.Body = c.Header()
return
})
err := e.ListenAndServe(":3000")
if err != nil {
panic(err)
}
}