Skip to content

feat(http): send quicknode-cli user agent on all requests (DX-5655)#13

Merged
johnpmitsch merged 1 commit into
mainfrom
dx-5655-send-a-quicknode-cliversion-user-agent-on-all-api-requests
Jun 11, 2026
Merged

feat(http): send quicknode-cli user agent on all requests (DX-5655)#13
johnpmitsch merged 1 commit into
mainfrom
dx-5655-send-a-quicknode-cliversion-user-agent-on-all-api-requests

Conversation

@johnpmitsch

Copy link
Copy Markdown
Collaborator

Summary

Every qn request previously went out with the SDK's auto-generated User-Agent (quicknode-sdk-rust/<version> (...)), so CLI traffic was indistinguishable from direct SDK usage. All requests now carry:

quicknode-cli/<version> (<os>-<arch>)     e.g. quicknode-cli/0.1.3 (macos-aarch64)

mirroring the SDK's own UA shape, and set via the SDK's supported override: custom HttpConfig.headers replace SDK-managed headers of the same name (see the SDK README section "Custom headers and User-Agent").

  • New context::user_agent() builds the UA from CARGO_PKG_VERSION + std::env::consts::{OS, ARCH}, the same inputs the SDK uses.
  • New shared context::sdk_config(api_key) constructor applies the header at every SDK construction site — the main Ctx path and both auth paths (login key validation, whoami) — so no traffic escapes attribution.
  • SDK HTTP defaults (timeout, connection pooling) are untouched.

Test plan

  • requests_carry_the_cli_user_agent (tests/endpoint.rs): wiremock asserts the exact User-Agent header reaches the wire on qn endpoint list, .expect(1).
  • user_agent_identifies_the_cli: UA starts with quicknode-cli/ and contains the crate version.
  • sdk_config_sets_the_user_agent_header_and_nothing_else: header wired, timeout_secs/pool_max_idle_per_host stay None.
  • Full suite: cargo test green, cargo clippy --all-targets -- -D warnings clean, cargo fmt --check clean, release build clean.

Closes DX-5655

Every qn request previously went out with the SDK's auto-generated
User-Agent (quicknode-sdk-rust/<version>), making CLI traffic
indistinguishable from direct SDK usage. All requests now carry
'quicknode-cli/<version> (<os>-<arch>)', mirroring the SDK's UA shape,
set via the SDK-supported HttpConfig.headers override.

A shared context::sdk_config constructor applies the header at every
SDK construction site, including 'auth login' validation and
'auth whoami'. SDK HTTP defaults (timeout, pooling) are unchanged.

Tests: +3 (UA shape unit test, config wiring unit test, wiremock
wire-level header assertion on 'endpoint list').
@johnpmitsch johnpmitsch merged commit 296fbaa into main Jun 11, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants