-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat: Parameterize the fallback handler to httprule.Server
#48
feat: Parameterize the fallback handler to httprule.Server
#48
Conversation
Allow clients to define their own behavior in place of `http.NotFound` if none of the `httpRuleTemplates` were matched
I'm happy to merge something like this, but I'm not sure it's right as is:
While this is still a v0 module, I would still try to not break existing users. So to do the option arguments, I am considering renaming How does this sound? I'm happy to knock this together if you like. |
@boblail Also, would you mind giving a quick run down of your use case? That is, include the "why" in the commit message / PR description? I think the "why" is always important as it helps to understand how to review as well as providing context when looking at the history years later. |
I've pushed a couple of commits to the |
Everything you said sounds reasonable to me!
Here's our why: We have a fake server that serves both gRPC and REST fakes. We considered doing something like this: jigServer.SetHTTPHandler(handlerThatRecognizesRestRequests{next: httpruleHandler}) but we really want any incoming request whose path looks like a gRPC-Web request to be handled by the So — to our best understanding now — the logic we need is something like:
|
@boblail I won't be able to update your branch, since it's on a fork, so I'll raise a new PR with the changes from that branch. |
I've raised #49 - I'll get @juliaogris to review it so we can merge it. |
#49 has been merged now. Sorry for the delay. |
@camh-, this is great! Thanks for working with me on this! |
Allow clients to define their own behavior in place of
http.NotFound
if none of thehttpRuleTemplates
were matched