Skip to content

refactor: deduplicate checkIfBazaarNeeded across HTTP packages#1925

Open
natsukingly wants to merge 1 commit intox402-foundation:mainfrom
natsukingly:refactor/deduplicate-bazaar-check
Open

refactor: deduplicate checkIfBazaarNeeded across HTTP packages#1925
natsukingly wants to merge 1 commit intox402-foundation:mainfrom
natsukingly:refactor/deduplicate-bazaar-check

Conversation

@natsukingly
Copy link
Copy Markdown

Summary

checkIfBazaarNeeded was duplicated identically across 4 HTTP middleware packages (Express, Hono, Fastify, Next.js). This PR extracts it into @x402/core and replaces the local copies with a shared import.

Changes

  • Added checkIfBazaarNeeded to x402HTTPResourceServer.ts as an exported function
  • Added re-export from @x402/core/server
  • Removed identical local implementations from @x402/http-express, @x402/http-hono, @x402/http-fastify, @x402/http-next

Motivation

Reduces maintenance burden — any future changes to bazaar detection logic only need to happen in one place.

Test plan

  • Full monorepo build passes (pnpm run build)
  • All existing tests pass (pnpm run test)
  • Verify bazaar extension detection still works in each framework

@github-actions github-actions bot added typescript sdk Changes to core v2 packages labels Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sdk Changes to core v2 packages typescript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant