File: outbound_http_options.go

package info (click to toggle)
golang-gitlab-gitlab-org-labkit 1.17.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,092 kB
  • sloc: sh: 210; javascript: 49; makefile: 4
file content (28 lines) | stat: -rw-r--r-- 874 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package correlation

// The configuration for InjectCorrelationID.
type instrumentedRoundTripperConfig struct {
	clientName string
}

// InstrumentedRoundTripperOption will configure a correlation handler
// currently there are no options, but this gives us the option
// to extend the interface in a backwards compatible way.
type InstrumentedRoundTripperOption func(*instrumentedRoundTripperConfig)

func applyInstrumentedRoundTripperOptions(opts []InstrumentedRoundTripperOption) instrumentedRoundTripperConfig {
	config := instrumentedRoundTripperConfig{}
	for _, v := range opts {
		v(&config)
	}

	return config
}

// WithClientName will configure the X-GitLab-Client-Name header on the
// http client.
func WithClientName(clientName string) InstrumentedRoundTripperOption {
	return func(config *instrumentedRoundTripperConfig) {
		config.clientName = clientName
	}
}