Skip to content

feat(mrt-reference-app): add /outbound-loop route that calls the external domain#591

Draft
kieran-sf wants to merge 2 commits into
mainfrom
outbound-loop-reference-route
Draft

feat(mrt-reference-app): add /outbound-loop route that calls the external domain#591
kieran-sf wants to merge 2 commits into
mainfrom
outbound-loop-reference-route

Conversation

@kieran-sf

Copy link
Copy Markdown
Contributor

What

Adds a new /outbound-loop reference route to the MRT reference app. The handler (outboundLoopTest) makes an outbound request to the app's own storefront and returns the upstream response verbatim.

  • Reads the target domain from the EXTERNAL_DOMAIN_NAME env var (returns 400 if unset).
  • Prepends https:// only when the env var doesn't already include a scheme.
  • Accepts an optional ?path= query param (defaults to /).
  • Sends an x-mrt-loop: true header on the outbound request.
  • Passes the upstream status code, Content-Type, and body straight back to the caller.

Registered as GET /outbound-loop in server.ts.

Why

Provides a reference endpoint for exercising outbound requests from the reference app back to its own external domain.

Also included

scripts/build.mjs now emits build/config.server.js so b2c mrt bundle deploy reads the correct ssrOnly/ssrShared globs (otherwise the streaming entry point lands in neither bucket and the push is rejected).

Tests

Added coverage for outboundLoopTest: missing-domain 400, verbatim pass-through, the x-mrt-loop header, custom ?path=, no double-scheme, and upstream status propagation. All 212 package tests pass; lint and typecheck are clean.

…rnal domain

Adds an outboundLoopTest reference route that fetches the app's own
storefront via EXTERNAL_DOMAIN_NAME (optional ?path= override) with an
x-mrt-loop header and passes the upstream status, content-type, and body
back verbatim. Also emits build/config.server.js from the build so
`b2c mrt bundle deploy` reads the correct ssrOnly/ssrShared globs.
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