pub struct HttpConfig {Show 25 fields
pub expected_statuses: Vec<ExpectedStatus>,
pub max_idle_connections: usize,
pub keep_alive: Option<String>,
pub idle_connection_timeout: Option<String>,
pub request_timeout: Option<String>,
pub http2: bool,
pub http2_connections: usize,
pub user_agent: String,
pub decompress: bool,
pub discard_response_bodies: bool,
pub max_redirects: u32,
pub no_redirects: bool,
pub histogram_max_ms: Option<u64>,
pub dns_ttl: Option<String>,
pub dns_select: Option<String>,
pub dns_policy: Option<String>,
pub no_connection_reuse: bool,
pub no_vu_connection_reuse: bool,
pub rps: Option<f64>,
pub hosts: HashMap<String, String>,
pub blacklist_ips: Vec<String>,
pub max_response_bytes: Option<u64>,
pub proxy: ProxyConfig,
pub http_debug: bool,
pub http_debug_full: bool,
}Expand description
HTTP client configuration.
Fields§
§expected_statuses: Vec<ExpectedStatus>Expected response status codes/ranges that determine request success.
Used to drive the http_req_failed Rate metric.
Default: ["200-399"] — 2xx and 3xx are success, everything else fails.
max_idle_connections: usizeConnection pool max idle connections.
keep_alive: Option<String>Keep-alive duration.
idle_connection_timeout: Option<String>Timeout for idle connections.
request_timeout: Option<String>Global per-request timeout (k6 timeout), e.g. "30s". Applied as
the client-level ceiling for every request; a per-request timeout
overrides it with a shorter value. None (default) uses the engine
default of 10 seconds. Bounds how long a hung server can stall a VU
(which in turn bounds the engine’s VU-drain loop).
http2: boolWhether to enable HTTP/2.
http2_connections: usizeNumber of HTTP/2 connection lanes (default 1). Each lane is an independent reqwest::Client with its own connection pool. VUs are assigned to lanes round-robin by vu_id % N. Spreading load across N h2 connections hides per-connection server limits and parallelizes the single-core frame demux. k6 cannot do this at all.
user_agent: StringUser-agent header value.
decompress: boolWhether to decompress response bodies.
discard_response_bodies: boolWhether to discard response bodies entirely (don’t store bytes). Saves memory and bandwidth at the cost of not being able to inspect response content in scripts.
max_redirects: u32Max redirects to follow.
no_redirects: boolDisable redirect following entirely (--no-redirects). When true the
3xx response is returned as-is and no redirect hops are captured.
k6 always follows redirects; this flag lets Tropel opt out.
histogram_max_ms: Option<u64>Optional fixed ceiling for the latency histogram, in MILLISECONDS.
None (default) uses hdrhistogram auto-resize — no ceiling, so very
slow requests are recorded exactly instead of being clipped at 60 s.
Set this to bound memory for runs with pathological outliers.
dns_ttl: Option<String>DNS cache TTL (k6 dns.ttl), e.g. "5m", "inf". None (default)
disables caching — every request resolves. "0" also disables it.
dns_select: Option<String>DNS address selection policy (k6 dns.select): "first",
"roundRobin", "random". None (default) keeps all resolved
addresses in lookup order (reqwest’s default behavior).
dns_policy: Option<String>DNS address policy (k6 dns.policy): "preferIPv4", "preferIPv6",
"onlyIPv4", "onlyIPv6", "any". None (default) keeps the
resolved address family order unchanged.
no_connection_reuse: boolClose the connection after every request (k6 noConnectionReuse).
Disables connection pooling entirely — each request opens a fresh
connection, which trades latency for isolation.
no_vu_connection_reuse: boolk6 noVUConnectionReuse parity. When true, forces a fresh client
(own connection pool) per VU. Default false: every VU shares one
pooled client via Arc clone, keeping connections warm and TLS
sessions reusable.
rps: Option<f64>Global request-rate cap in requests/second (k6 rps). When set, the
whole run is paced so no more than this many requests start per second,
shared across all VUs. None (default) is unlimited.
hosts: HashMap<String, String>Static hostname → IP mapping (k6 hosts), e.g.
{"api.example.com": "127.0.0.1"}. Lookups for these hosts are served
from the map without hitting DNS. Values may be comma-separated to
provide several addresses; keys may be wildcards ("*.example.com").
blacklist_ips: Vec<String>IP addresses / CIDRs that requests may never connect to (k6
blacklistIPs), e.g. ["10.0.0.0/8", "192.168.1.5"]. When every
resolved address is blacklisted the request fails with a clear error.
max_response_bytes: Option<u64>Hard ceiling on the response body size in BYTES, enforced while the
body is streamed (final response AND redirect-hop bodies). None
(default) is unlimited — k6 semantics. Proxy-style consumers
(KnockPort relay) set this so a runaway upstream can’t fill memory.
proxy: ProxyConfigLog every HTTP request/response at debug level (method, URL, status,
timing). Off by default; enable with the --http-debug CLI flag.
k6’s --http-debug=full also prints request/response bodies — that
extra mode is http_debug_full.
Proxy configuration (ask 17). ProxyMode::Off by default, so every
existing config behaves exactly as before. The container’s own
#[serde(default)] covers an absent key.
http_debug: bool§http_debug_full: bool--http-debug=full (k6 parity): also print the request/response
bodies, not just the head lines. Only meaningful with http_debug.
Trait Implementations§
Source§impl Clone for HttpConfig
impl Clone for HttpConfig
Source§fn clone(&self) -> HttpConfig
fn clone(&self) -> HttpConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more