-
Notifications
You must be signed in to change notification settings - Fork 27
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
Handle serving from a sub-path #48
Conversation
First of all, the feature is certainly welcome, thank you 👍
I also don't think it's the best approach and rather compute it at startup and store it in a I will have a closer look and more comments by the end of the week. |
cbb71a1 gives a shot at addressing this. I have added a newtype for BasePath and used I am not a super fan of handling all errors there, but raising them would require a bigger change. Happy to hear thoughts about it. Also, we need to add a trailing slash to the base path. I do it if missing, but we might decide to validate/raise instead. Overall kept things pretty simple, but the code looks cleaner now by using I considered adding a newtype for the BaseUrl too, but eventually decided against it as it doesn't add much value. Also, open to comments about the best way to test this. We could duplicate the tests and/or the client, but maybe there are better approaches (e.g. test parametrisation, fixtures, ecc). |
Up to you, so far things look good to me. If you think it's ready, let me know. |
Done! I have considered using parametrised tests, but since we use static variables things get complicated pretty fast. In the end I have opted for simplicity: the tests respect BASE_URL and the CI runs both on Ready from my point of view! |
Thanks, I will let it simmer for a bit and try to make a new release soon enough. |
Thank you! When you do release, could you also update the README? I forgot to do that. |
Hi there! 👋
I took a shot at letting
wastebin
work when served from a sub-path (e.g. https://example.com/wastsebin/). It's a WIP, but I thought of getting this out early and discuss 1. if useful; 2. improvements.The idea is to re-use the
WASTEBIN_BASE_URL
variable and get itspath
component (if any).Right now:
What's the best approach to add the test? Duplicate them? Run them in a
for
loop with / without the sub-path?Also, I am not convinced of storing the base path in the
metadata
as a static variable. Are there other approaches?