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

[QUESTION] Relative Path #795

Closed
victoraugustolls opened this issue Jan 13, 2020 · 9 comments
Closed

[QUESTION] Relative Path #795

victoraugustolls opened this issue Jan 13, 2020 · 9 comments

Comments

@victoraugustolls
Copy link

victoraugustolls commented Jan 13, 2020

Hi!

I looked through the docs but might have missed something.

Is it possible to extract the relative path from a Request?
If I have a route like /users/{id}, I would like to get exactly this value, and not the absolute path with the id value.

Thanks!

@tomchristie
Copy link
Member

Sure thing... request.url.path

@victoraugustolls
Copy link
Author

Actually this returned the full path, like /users/123 instead of /users/{id}.
@tomchristie

@tomchristie
Copy link
Member

Right, I see what you're asking. (Tho that's not "absolute path" vs. "relative path".)
No there's not really a way to do that at the moment.
What's the use-case?

@victoraugustolls
Copy link
Author

Grouping logs by path. In my use case, Microsoft Application Insights, which I need to set an operation name for them to group by it, and the path rule (?) would be the best way to do it.

Is this in the backlog or desirable to have in Starlette?

@tomchristie
Copy link
Member

Is this in the backlog or desirable to have in Starlette?

There's this, which covers some similar ground... #685

I think we'd eventually want to include something like a request.route property.

@victoraugustolls
Copy link
Author

victoraugustolls commented Jan 14, 2020

Seems to be pretty much my use case...
In any way, thanks for the help, hope Starlette implement this soon :)
Will try to look through the code to see if I can help also.

@victoraugustolls
Copy link
Author

@tomchristie would you help me by pointing me to the right direction to help with this?

@BrikerMan
Copy link

@tomchristie @victoraugustolls Any updaye on this issue?

@victoraugustolls
Copy link
Author

Hey @BrikerMan ! There is a PR (#804) but it is pretty much stuck.

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

No branches or pull requests

3 participants