MCPcopy
hub / github.com/gin-gonic/gin / Header

Method Header

context.go:1080–1086  ·  context.go::Context.Header

Header is an intelligent shortcut for c.Writer.Header().Set(key, value). It writes a header in the response. If value == "", this method removes the header `c.Writer.Header().Del(key)`

(key, value string)

Source from the content-addressed store, hash-verified

1078// It writes a header in the response.
1079// If value == "", this method removes the header `c.Writer.Header().Del(key)`
1080func (c *Context) Header(key, value string) {
1081 if value == "" {
1082 c.Writer.Header().Del(key)
1083 return
1084 }
1085 c.Writer.Header().Set(key, value)
1086}
1087
1088// GetHeader returns value from request headers.
1089func (c *Context) GetHeader(key string) string {

Calls 1

SetMethod · 0.80