mirror of
https://github.com/rancher/norman.git
synced 2025-09-01 23:36:58 +00:00
APIContext constructor
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user