-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
http pool basePath getter and/or setter? #22
Comments
Can't you just wrap the handler with http.StripPrefix/ |
The way I understand it no, but I'd gladly stand corrected. Groupcache handles everything by default, and panics if that doesn't begin with its basePath (/_groupcache), that is not configurable (and has the comment: I just hard coded that into my code, but you know, it feels wrong :) |
I wouldn't be opposed to adding these methods:
|
Alright, I'll gladly do this and add do a PR. |
@nf wouldn't it be a tad more elegant, instead of adding a setter to simply add in http.go (67): func NewHTTPPool(self, basePath string) *HTTPPool {
... I mean, you wouldn't change the basePath during serving. |
Yep, probably. |
Do that :-) |
I just hit this, I'd even be happy if defaultBasePath was DefaultBasePath so that muxer registration wasn't by a copy of the constant. |
I'm building a server that uses groupcache, and I would like to be able to conveniently wrap the http pool's handler inside a mux (specifically to add a monitoring status call on the server).
I simply thought of adding a handler func that forwards everything under /_groupcache/ to groupcache's handler. But this will fail if ever the hard coded base path will change.
So I thought of adding at least a getter, if not a setter for the base path. I understand the consistency problem with adding a setter. Will a pull request for GetBasePath() and/or SetBasePath() be accepted?
The text was updated successfully, but these errors were encountered: