Skip to content

feat: Add createOriginMiddleware function#8522

Open
FrederikBolding wants to merge 3 commits intomainfrom
fb/add-origin-middleware
Open

feat: Add createOriginMiddleware function#8522
FrederikBolding wants to merge 3 commits intomainfrom
fb/add-origin-middleware

Conversation

@FrederikBolding
Copy link
Copy Markdown
Member

@FrederikBolding FrederikBolding commented Apr 20, 2026

Explanation

Add a createOriginMiddleware function which adds the origin to the MiddlewareContext, to be leveraged by later middlewares.

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: adds a small new middleware helper and export without changing existing request handling behavior.

Overview
Adds a new createOriginMiddleware(origin) utility for JsonRpcEngineV2 that sets context.origin and then delegates to next().

Exports the helper from @metamask/json-rpc-engine/v2, adds a unit test to validate context propagation, and updates the package changelog to announce the new API.

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

@FrederikBolding FrederikBolding marked this pull request as ready for review April 20, 2026 11:26
@FrederikBolding FrederikBolding requested review from a team as code owners April 20, 2026 11:26
@FrederikBolding FrederikBolding changed the title feat: Add createOriginMiddleware feat: Add createOriginMiddleware function Apr 20, 2026
Copy link
Copy Markdown
Member

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Literally perfect

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