-
-
Notifications
You must be signed in to change notification settings - Fork 88
Context.clone() method
#237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a new Context.clone() method for Context, RequestContext, and InboxContext in order to easily create new context instances with updated data while preserving the remaining properties. Key changes include adding a default clone implementation in factory functions, overriding clone in concrete context classes, and updating tests and documentation to verify and demonstrate the new functionality.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| fedify/testing/context.ts | Added default clone implementations in createContext, createRequestContext, and createInboxContext. |
| fedify/federation/middleware.ts | Implemented clone overrides in ContextImpl, RequestContextImpl, and InboxContextImpl. |
| fedify/federation/middleware.test.ts | Added test steps to verify the behavior of Context.clone() and RequestContext.clone(). |
| fedify/federation/handler.test.ts | Updated InboxContext factory usage to ensure the new clone property is not propagated unintentionally. |
| fedify/federation/context.ts | Updated context interfaces to include the clone method. |
| docs/manual/context.md | Revised documentation to include instructions and examples for using Context.clone(). |
| CHANGES.md | Added a changelog entry for Context.clone() implementation. |
8db9ad5 to
1d68abf
Compare
|
The latest push to this pull request has been published to JSR and npm |
|
The latest push to this pull request has been published to JSR and npm as a pre-release: |
|
The latest push to this pull request has been published to JSR and npm as a pre-release: |
|
🎉 Published on https://unstable.fedify.dev as production |
|
The latest push to this pull request has been published to JSR and npm as a pre-release: |
|
The latest push to this pull request has been published to JSR and npm as a pre-release: |
Implements clone() method for all context types (Context, RequestContext, InboxContext) to create new contexts with modified data while preserving other properties. Updates documentation and tests accordingly.
|
The latest push to this pull request has been published to JSR and npm as a pre-release: |
|
The docs for this pull request have been published: |
Implements
clone()method for all context types (Context,RequestContext,InboxContext) to create new contexts with modified data while preserving other properties. Updates documentation and tests accordingly.