Skip to content
Docs
Changelog

One outbound HTTP call module and one bounded stream reader

Every request the Worker sends to another host now goes through one module that sets the deadline, never follows a redirect, bounds the answer and classifies the failure. Transports keep only their domain mapping.

Markdown

  • New package packages/http. outboundCallEffect in @fofo/http/outbound makes one call with a deadline, the caller's cancellation, redirect: "manual" (a 3xx is a failure), a bounded read of the answer and one tagged failure: network, timeout, status with Retry-After, redirect, invalid-body or cancelled. outboundCall is its Promise facade. @fofo/http/read-bounded holds the one bounded stream reader (readBounded, boundedChunks, readBoundedJson). See packages/http and backend conventions. (#244)
  • Every transport uses it. Stripe, Polar and Pagar.me requests, the RevenueCat verification (its copy of the same logic is gone), Expo push, webhook deliveries (the SSRF check still runs first), the Resend and Cloudflare REST email providers, the error tunnel's forward, the Cloudflare analytics read, the GitHub issue and the S3 control requests keep only what a failure means for them. Eight hand-written reader loops became one. (#244)
  • Changed on purpose. A payment provider's 408 or 425 is now retryable like 429 and 5xx, as push and webhooks already treated them. The tracker's answer to a forwarded error envelope is bounded at 64 KiB; past it the tunnel answers 502. (#244)
  • A test keeps the calls in one place. scripts/outbound-http.test.mjs fails on a fetch call in Worker-side code outside the module and on a stream reader outside the bounded reader. It replaces scripts/workerd-fetch-redirect.test.mjs: with one call site, the redirect mode is asserted once, in the module's own suite. In a project made from this template, new outbound code calls the module instead of fetch. (#244)
Edit on GitHubDocumentation is in English.
Cookie settings
We use essential cookies to make our app work. With your consent, we also use optional cookies to improve your experience.

Read our Cookie Policy and Privacy Policy.