diff options
| author | Shulhan <ms@kilabit.info> | 2024-02-21 01:29:25 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2024-02-21 01:34:56 +0700 |
| commit | 9ca138628023b926ddf07cbd2e93562b8e782cf6 (patch) | |
| tree | b2c4524d4ed5ebd7098ad69c2917ee49159e2d93 /example.go | |
| parent | 99999635f67931e1a6deb608f13b2dc2ecd9df73 (diff) | |
| download | gorankusu-9ca138628023b926ddf07cbd2e93562b8e782cf6.tar.xz | |
all: add global HTTP headers for Target
The Headers field on Target define the global headers that will be send
along with all HTTPTarget or WebSocketTarget.
The same header can also be defined on HTTPTarget that override the
value of Target.
Diffstat (limited to 'example.go')
| -rw-r--r-- | example.go | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -210,6 +210,8 @@ func (ex *Example) registerWebSocketEndpoints() (err error) { } func (ex *Example) registerTargetHTTP() (err error) { + const headerAuthorization = `Authorization` + var targetHTTP = &Target{ ID: `example_http`, Name: `Example HTTP`, @@ -219,6 +221,12 @@ func (ex *Example) registerTargetHTTP() (err error) { Duration: 10 * time.Second, RatePerSecond: 1, }, + Headers: KeyFormInput{ + headerAuthorization: FormInput{ + Label: `Authorization`, + Hint: `Global authorization header.`, + }, + }, Vars: KeyFormInput{ `A`: FormInput{ Label: `A`, @@ -235,6 +243,10 @@ func (ex *Example) registerTargetHTTP() (err error) { Path: pathExample, RequestType: libhttp.RequestTypeQuery, Headers: KeyFormInput{ + headerAuthorization: FormInput{ + Label: `Authorization`, + Hint: `Global authorization header.`, + }, `X-Get`: FormInput{ Label: `X-Get`, Hint: `Custom HTTP header to be send.`, |
