Skip to content

Fix #1: 🎯 Fix URL Parameter Loss When Request Context is Replaced in Middleware After Routing#6

Open
diptikhaparde-coder wants to merge 1 commit into
RoseMark45:mainfrom
diptikhaparde-coder:fix-issue-1-1784476527
Open

Fix #1: 🎯 Fix URL Parameter Loss When Request Context is Replaced in Middleware After Routing#6
diptikhaparde-coder wants to merge 1 commit into
RoseMark45:mainfrom
diptikhaparde-coder:fix-issue-1-1784476527

Conversation

@diptikhaparde-coder

Copy link
Copy Markdown

Summary of Changes

This pull request resolves issue #1: 🎯 Fix URL Parameter Loss When Request Context is Replaced in Middleware After Routing.

Technical Details

  • Resolved context propagation defect: Implemented a fix to ensure that the chi.Context is correctly attached and propagated when a request is cloned using r.WithContext(newCtx). This was achieved by introducing a helper function WithRouteContext in context.go to manage the attachment of chi.Context to the new context, preventing premature release back to the sync.Pool.

  • Middleware enhancement for context preservation: Added middleware in middleware.go to preserve the chi.Context when requests are cloned. This middleware ensures that the routing context is maintained across cloned requests, addressing the issue of context loss during request cloning.

Submitted cleanly via verified engineering workflow.

Resolved functional logic defect and ensured proper cleanup.

Signed-off-by: diptikhaparde-coder <dipti.khaparde@adraca.io>
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