MCPcopy
hub / github.com/nats-io/nats.go / WithHeaders

Function WithHeaders

micro/request.go:164–175  ·  view source on GitHub ↗

WithHeaders can be used to configure response with custom headers.

(headers Headers)

Source from the content-addressed store, hash-verified

162
163// WithHeaders can be used to configure response with custom headers.
164func WithHeaders(headers Headers) RespondOpt {
165 return func(m *nats.Msg) {
166 if m.Header == nil {
167 m.Header = nats.Header(headers)
168 return
169 }
170
171 for k, v := range headers {
172 m.Header[k] = v
173 }
174 }
175}
176
177// Data returns request data.
178func (r *request) Data() []byte {

Callers 1

TestRequestRespondFunction · 0.92

Calls

no outgoing calls

Tested by 1

TestRequestRespondFunction · 0.74