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

How to convert http.HandlerFunc to rest.HandlerFunc #192

Open
Telmo opened this issue Jul 20, 2016 · 2 comments
Open

How to convert http.HandlerFunc to rest.HandlerFunc #192

Telmo opened this issue Jul 20, 2016 · 2 comments

Comments

@Telmo
Copy link

Telmo commented Jul 20, 2016

I am trying to create a prometheus middleware for go-json-rest and I am running into issues due to the differences between the rest.ResponseWriter and the http.ResponseWriter

I am able to get the http.HandlerFunc for prometheus but when trying to get it into a rest.Get I am unable to convert the http.HandlerFunc into a rest.HandlerFunc as far as I can tell the only difference between them is the ResponseWriter

https://godoc.org/net/http#ResponseWriter
https://godoc.org/github.com/ant0ine/go-json-rest/rest#ResponseWriter

Is there a way to accomplish this? I am fairly new to go so if the answer is pretty obvious I apologize in advance :)

@ajpen
Copy link

ajpen commented Sep 1, 2016

Agreed. There should be methods to switch from http.Request to rest.Request. Same for ResponseWriter

@ajpen
Copy link

ajpen commented Sep 29, 2016

@Telmo You mind checking if that PR fixes the issue?

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