Skip to content
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

Make ContextData() available to middleware #81

Merged
merged 1 commit into from
Mar 30, 2021

Conversation

ninthclowd
Copy link

@ninthclowd ninthclowd commented Mar 29, 2021

Thanks a lot for httptreemux! Solid router :)

This commit populates the context data after the middleware has all been added to the handler, instead of before. This makes the Context* functions available for use in all middleware, addressing #73.

@dimfeld
Copy link
Owner

dimfeld commented Mar 29, 2021

I should have a chance to look at this tonight or tomorrow. Thank you!

@ninthclowd ninthclowd force-pushed the master branch 3 times, most recently from 291a981 to d88fe47 Compare March 29, 2021 22:30
add test for retrieving context data in middleware
@ninthclowd
Copy link
Author

Ok sorry about the additional commits. I added a test that will fail if ContextData is not available in the middleware layer.

@dimfeld
Copy link
Owner

dimfeld commented Mar 30, 2021

In order to keep compatibility with really old Go versions, and to reduce allocations for people who are using the old-style handlers and don't want Context, I moved things around a bit.

I made a new PR, #82, which has the code. If that looks ok to you then I think this is good to go. Thanks!

@dimfeld dimfeld merged commit 6d2b694 into dimfeld:master Mar 30, 2021
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.

None yet

2 participants