1
0
mirror of https://github.com/rancher/norman.git synced 2025-09-01 23:36:58 +00:00

APIContext constructor

This commit is contained in:
Darren Shepherd
2018-01-19 21:29:24 -07:00
parent dfade4fcef
commit aa2538a874
2 changed files with 21 additions and 8 deletions

View File

@@ -69,14 +69,9 @@ func DefaultURLParser(schemas *types.Schemas, url *url.URL) (ParsedURL, error) {
func Parse(rw http.ResponseWriter, req *http.Request, schemas *types.Schemas, urlParser URLParser, resolverFunc ResolverFunc) (*types.APIContext, error) {
var err error
result := &types.APIContext{
Schemas: schemas,
Request: req,
Response: rw,
Method: parseMethod(req),
ResponseFormat: parseResponseFormat(req),
}
result := types.NewAPIContext(req, rw, schemas)
result.Method = parseMethod(req)
result.ResponseFormat = parseResponseFormat(req)
result.URLBuilder, _ = urlbuilder.New(req, types.APIVersion{}, schemas)
// The response format is guarenteed to be set even in the event of an error