Skip to content

refactor(router): compose the worker from modular middleware - #72

Draft
natemoo-re wants to merge 2 commits into
feat/agentsfrom
refactor/router-primitives
Draft

refactor(router): compose the worker from modular middleware#72
natemoo-re wants to merge 2 commits into
feat/agentsfrom
refactor/router-primitives

Conversation

@natemoo-re

@natemoo-re natemoo-re commented Aug 15, 2026

Copy link
Copy Markdown
Member

What does this PR do?

The router grew into a single fetch handler mixing redirects, negotiation, proxying, and header policy — untestable without a deployed origin and awkward to extend. This recomposes it as single-concern modules on Hono (hono/tiny), with the upstream fetcher injectable so the full request pipeline is testable in-process.

  • compose the worker from modular primitives: redirects, markdown negotiation, proxy, origin mapping, config
  • inject the upstream fetcher so app.request() tests exercise the whole pipeline without wrangler
  • keep behavior identical: same routes, headers, status mapping, and cache-key strategy
  • cover redirects, negotiation, 404 mapping, and passthrough with integration tests (25 total)

No linked issue — stacked on #71.

Type of change

  • Typo
  • New Documentation for Feature
  • Improvement for Clarification
  • Chore (dependencies, CI, tooling)

AI-generated code disclosure

  • This PR includes AI-generated code

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 15, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bombshell-docs f56f7b2 Commit Preview URL

Branch Preview URL
Aug 15 2026, 04:09 AM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 15, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bombsh-docs-router f56f7b2 Commit Preview URL

Branch Preview URL
Aug 15 2026, 04:08 AM

@natemoo-re natemoo-re changed the title refactor/router primitives refactor(router): compose the worker from modular middleware Aug 15, 2026
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedhono@​4.13.21001009796100

View full report

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