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

Support for http.Handler? #34

Closed
ARolek opened this issue Oct 3, 2016 · 3 comments
Closed

Support for http.Handler? #34

ARolek opened this issue Oct 3, 2016 · 3 comments

Comments

@ARolek
Copy link
Contributor

ARolek commented Oct 3, 2016

Any plans to support http.Handler alongside http.HandlerFunc?

@ARolek ARolek changed the title Supper for http.Handler? Support for http.Handler? Oct 3, 2016
@dimfeld
Copy link
Owner

dimfeld commented Oct 3, 2016

Check out the recently merged #33.

@ARolek
Copy link
Contributor Author

ARolek commented Oct 4, 2016

@dimfeld I noticed support for http.HandlerFunc which is nice when working with a function, but I'm looking to leverage the http.Handler interface similar to httprouter's implementation. This allows for defining structs that adhere to the interface, for example:

type HandleFoo struct{
  Foo string
}

func (req HandleFoo) ServeHTTP(w http.ResponseWriter, r *http.Request) {
  // do stuff
}

@dimfeld
Copy link
Owner

dimfeld commented Oct 4, 2016

Ah, I see. I hadn't thought about doing this, but it seems like it should be pretty easy to do with a method similar to the http.HandlerFunc support. I can probably get it in later this week or would also be glad to take a PR.

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

2 participants