Skip to content

feat: Add legacy createOriginMiddleware#8734

Merged
FrederikBolding merged 3 commits intomainfrom
fb/origin-middleware-legacy
May 7, 2026
Merged

feat: Add legacy createOriginMiddleware#8734
FrederikBolding merged 3 commits intomainfrom
fb/origin-middleware-legacy

Conversation

@FrederikBolding
Copy link
Copy Markdown
Member

@FrederikBolding FrederikBolding commented May 7, 2026

Explanation

Recently we added createOriginMiddleware to v2 for usage in the clients. Though using it via asLegacyMiddleware introduces some complications, so for the time being we introduce the same middleware using the legacy API.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Low Risk
Low risk additive change: introduces a new legacy middleware and export without altering existing middleware behavior, with a small chance of conflicts for consumers that already attach an origin field to requests.

Overview
Adds a legacy createOriginMiddleware for @metamask/json-rpc-engine that mutates the JSON-RPC request object to include an origin string (marked deprecated in favor of the v2 API).

Exports the new utility from the package entrypoint, updates export snapshot tests, adds a unit test verifying origin is set, and records the addition in the package changelog.

Reviewed by Cursor Bugbot for commit 710f931. Bugbot is set up for automated code reviews on this repo. Configure here.

@FrederikBolding FrederikBolding marked this pull request as ready for review May 7, 2026 12:34
@FrederikBolding FrederikBolding requested review from a team as code owners May 7, 2026 12:34
@FrederikBolding FrederikBolding requested a review from Mrtenz May 7, 2026 13:05
@FrederikBolding FrederikBolding added this pull request to the merge queue May 7, 2026
Merged via the queue into main with commit c351602 May 7, 2026
366 checks passed
@FrederikBolding FrederikBolding deleted the fb/origin-middleware-legacy branch May 7, 2026 15:14
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.

2 participants