mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
feat: add load testing harness, coder loadtest command (#4853)
This commit is contained in:
@ -44,6 +44,10 @@ type Client struct {
|
||||
HTTPClient *http.Client
|
||||
SessionToken string
|
||||
URL *url.URL
|
||||
|
||||
// BypassRatelimits is an optional flag that can be set by the site owner to
|
||||
// disable ratelimit checks for the client.
|
||||
BypassRatelimits bool
|
||||
}
|
||||
|
||||
type RequestOption func(*http.Request)
|
||||
@ -87,6 +91,9 @@ func (c *Client) Request(ctx context.Context, method, path string, body interfac
|
||||
return nil, xerrors.Errorf("create request: %w", err)
|
||||
}
|
||||
req.Header.Set(SessionCustomHeader, c.SessionToken)
|
||||
if c.BypassRatelimits {
|
||||
req.Header.Set(BypassRatelimitHeader, "true")
|
||||
}
|
||||
|
||||
if body != nil {
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
|
Reference in New Issue
Block a user