MCPcopy
hub / github.com/elastic/go-elasticsearch / WithHeader

Method WithHeader

esapi/api.get.go:356–365  ·  view source on GitHub ↗

WithHeader adds the headers to the HTTP request.

(h map[string]string)

Source from the content-addressed store, hash-verified

354
355// WithHeader adds the headers to the HTTP request.
356func (f Get) WithHeader(h map[string]string) func(*GetRequest) {
357 return func(r *GetRequest) {
358 if r.Header == nil {
359 r.Header = make(http.Header)
360 }
361 for k, v := range h {
362 r.Header.Add(k, v)
363 }
364 }
365}
366
367// WithOpaqueID adds the X-Opaque-Id header to the HTTP request.
368func (f Get) WithOpaqueID(s string) func(*GetRequest) {

Callers 4

newTransportFunction · 0.45
TestContentTypeOverrideFunction · 0.45
runEsapiExampleFunction · 0.45
TestAPIFunction · 0.45

Calls 1

AddMethod · 0.65

Tested by 2

TestContentTypeOverrideFunction · 0.36
TestAPIFunction · 0.36