-
-
Notifications
You must be signed in to change notification settings - Fork 290
fix: auth route conflict #987
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
base: main
Are you sure you want to change the base?
Conversation
@VishnuSanal is attempting to deploy a commit to the sparckles Team on Vercel. A member of the Team first needs to authorize it. |
todo:
|
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.
Hey @VishnuSanal 👋
Overall , I like the approach ✨
I can do a review on the execution when it is up for review 😄
CodSpeed Performance ReportMerging #987 will not alter performanceComparing Summary
|
Hey @VishnuSanal , can you fetch the latest changes here?? |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Co-authored-by: Sanskar Jethi <29942790+sansyrox@users.noreply.github.com>
Hi all, same issue here. Any blockers for merging this? Let me know if I can help somehow! |
Hey @alissonpelizaro 👋 Apologies for the delay in review. I planned to review this over the weekend. If possible, could you do an initial review please? |
HttpMethod.GET, | ||
async_inner_handler, | ||
injected_dependencies, | ||
) | ||
else: | ||
self.add_route(middleware_type, endpoint, inner_handler, injected_dependencies) | ||
self.add_route(middleware_type, endpoint, HttpMethod.GET, inner_handler, injected_dependencies) |
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.
why is this a GET http method? Is a middleware always treated as a get request?
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.
why is this a GET http method? Is a middleware always treated as a get request?
@sansyrox we are defaulting to GET. previously the value added to routes were just the endpoint, which caused the key conflicts. with this PR, we are making it "<http_method>/". and, I am defaulting all middleware requests to GET. do you think it is a bad idea? I have also tried making it "<middleware_type>/" (code here: https://github.com/VishnuSanal/Robyn/tree/fix-auth-route-conflict-new), but that breaks the middleware tests & I am unable to find a way around. what do you think? which approach to follow?
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.
why is this a GET http method? Is a middleware always treated as a get request?
update:
yes, here, the req.method()
returns GET
for all middleware requests. I now realize that this is why the approach on my previous comment didn't work.
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.
why is this a GET http method? Is a middleware always treated as a get request?
@sansyrox
This is just to fulfill the trait definition requirement as defined in mod.rs
if you pass anything here, it will still work
this is middleware router which works differently than base/global router which do lookup based on method + endpoint
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.
This PR needs some more work and is up for grabs as @VishnuSanal is unfortunately away for some time.
07f28de
to
0b766c9
Compare
# Conflicts: # robyn/processpool.py
6bc00d2
to
9037f39
Compare
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.
@VishnuSanal
All looks good to me, except the variable names
Do use correct name which represent their actual property
Like route_type used in python to pass http_method but same parameter name is used as middleware_type in rust which creates little bit confusion,
so please avoid that
so use http_method where it's route_type and use middleware_type where it's of type middleware_type
some variables are used wrongly before also, do check and fix them also
here are some files:
https://github.com/sparckles/Robyn/blob/main/src/routers/middleware_router.rs
@k4976 thanks for your review. but I have some questions.
I didn't quite get this 🤔 we are using:
and the signature for the same on
here, the
I don't think this is the scope of this PR. please create an issue & let's address it in another PR :) |
|
😱 Found 2 issues. Time to roll up your sleeves! 😱 |
Description
This PR fixes #982
Summary
This PR does fix authenticated routes with different method but same path causing conflict
PR Checklist
Please ensure that:
Pre-Commit Instructions: