Skip to content

feat: brand new client api; hooks; refactor#4

Merged
StopMakingThatBigFace merged 16 commits intomainfrom
feat/v1
Apr 12, 2026
Merged

feat: brand new client api; hooks; refactor#4
StopMakingThatBigFace merged 16 commits intomainfrom
feat/v1

Conversation

@StopMakingThatBigFace
Copy link
Copy Markdown
Owner

node-wreq 1.0.0

node-wreq now ships a much more complete fetch-style API on top of the Rust transport powered by wreq.

Highlights

  • Added a new fetch-oriented public API with:
    • fetch(input, init?)
    • createClient(defaults?)
    • Request
    • Response
    • Headers
  • Added WHATWG-style WebSocket support:
    • new WebSocket(url, init?)
    • await websocket(url, init?)
    • support for browser-like lifecycle, binary payloads, protocols, handshake validation, and cookie-backed handshakes
  • Added request lifecycle hooks:
    • init
    • beforeRequest
    • afterResponse
    • beforeRetry
    • beforeError
    • beforeRedirect
  • Added pluggable cookieJar support for both HTTP requests and WebSocket handshakes
  • Added redirect and retry orchestration in the JS pipeline
  • Added richer fetch-style response handling:
    • stream-backed bodies
    • clone()
    • json(), text(), arrayBuffer(), blob(), formData()
    • extra metadata under response.wreq
  • Added response metadata and observability surfaces:
    • timings
    • redirect chain
    • cookies / set-cookie exposure
    • Node-readable conversion via response.wreq.readable()
  • Added advanced transport/emulation controls:
    • browser profiles
    • exact header order / original header names
    • tlsOptions
    • http1Options
    • http2Options

Internal Refactor

  • Refactored the package around a clearer module structure:
    • src/http/*
    • src/client/*
    • src/websocket/*
    • src/native/*
    • src/types/*
  • Split Rust internals into transport, N-API, emulation, and runtime/store layers
  • Added generated browser profile plumbing and cleaner native binding boundaries

Tooling and Release Infrastructure

  • Replaced the old formatting setup with oxlint + oxfmt
  • Added local pre-commit hooks for lint autofix and formatting
  • Added scoped platform package publishing flow for:
    • @node-wreq/darwin-x64
    • @node-wreq/darwin-arm64
    • @node-wreq/linux-x64-gnu
    • @node-wreq/linux-arm64-gnu
    • @node-wreq/linux-x64-musl
    • @node-wreq/win32-x64-msvc
  • Added GitHub trusted publishing support for npm releases
  • Release versions can now be derived from the GitHub release tag instead of the repo’s local placeholder version

Docs

  • Rewrote the README into an example-first reference
  • Expanded docs around architecture, publishing, observability, retries, redirects, hooks, cookies, networking, and WebSockets

Tests

  • Added coverage for:
    • hooks and retries
    • cookies and redirects
    • HTTP client behavior
    • response streaming and cloning
    • WebSocket lifecycle and handshake behavior

@StopMakingThatBigFace StopMakingThatBigFace merged commit ff90247 into main Apr 12, 2026
33 checks passed
@StopMakingThatBigFace StopMakingThatBigFace deleted the feat/v1 branch April 12, 2026 20:42
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.

1 participant