Put user in context, map requests to context above resthandler layer

This commit is contained in:
Jordan Liggitt
2015-02-11 17:09:25 -05:00
parent ec66e5147e
commit 083ce268e0
14 changed files with 290 additions and 146 deletions

View File

@@ -78,6 +78,7 @@ type ProxyHandler struct {
prefix string
storage map[string]RESTStorage
codec runtime.Codec
context api.RequestContextMapper
apiRequestInfoResolver *APIRequestInfoResolver
}
@@ -97,7 +98,11 @@ func (r *ProxyHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
verb = requestInfo.Verb
namespace, resource, parts := requestInfo.Namespace, requestInfo.Resource, requestInfo.Parts
ctx := api.WithNamespace(api.NewContext(), namespace)
ctx, ok := r.context.Get(req)
if !ok {
ctx = api.NewContext()
}
ctx = api.WithNamespace(ctx, namespace)
if len(parts) < 2 {
notFound(w, req)
httpCode = http.StatusNotFound