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

proposal: x/net/context/ctxhttp: Context-aware HTTP handlers #13115

Closed
kyleconroy opened this issue Oct 31, 2015 · 1 comment
Closed

proposal: x/net/context/ctxhttp: Context-aware HTTP handlers #13115

kyleconroy opened this issue Oct 31, 2015 · 1 comment

Comments

@kyleconroy
Copy link

Proposal: add a context-aware handler interface that is similar to/mirrors http.Handler and http.HandlerFunc

type Handler interface {
    ServeHTTP(context.Context, http.ResponseWriter, *http.Request)
}

type HandlerFunc func(context.Context, http.ResponseWriter, *http.Request)

// ServeHTTP calls f(w, r).
func (f HandlerFunc) ServeHTTP(c context.Context, w http.ResponseWriter, r *http.Request) {
    f(c, w, r)
}

In the future, we’d also want to add a ServerMux that implements the above interface. Thoughts?

@bradfitz
Copy link
Contributor

This is a dup of rejected https://go-review.googlesource.com/#/c/15620/

Conversation continues in #13021 (moving context to std).

@golang golang locked and limited conversation to collaborators Nov 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants