MCPcopy
hub / github.com/labstack/echo / NewContext

Method NewContext

echo.go:414–416  ·  view source on GitHub ↗

NewContext returns a new Context instance. Note: both request and response can be left to nil as Echo.ServeHTTP will call c.Reset(req,resp) anyway these arguments are useful when creating context for tests and cases like that.

(r *http.Request, w http.ResponseWriter)

Source from the content-addressed store, hash-verified

412// Note: both request and response can be left to nil as Echo.ServeHTTP will call c.Reset(req,resp) anyway
413// these arguments are useful when creating context for tests and cases like that.
414func (e *Echo) NewContext(r *http.Request, w http.ResponseWriter) *Context {
415 return newContext(r, w, e)
416}
417
418// Router returns the default router.
419func (e *Echo) Router() Router {

Callers 15

BenchmarkAllocJSONPFunction · 0.80
BenchmarkAllocJSONFunction · 0.80
BenchmarkAllocXMLFunction · 0.80
TestContextEchoFunction · 0.80
TestContextRequestFunction · 0.80
TestContextResponseFunction · 0.80
TestContextStreamFunction · 0.80
TestContextJSONFunction · 0.80
TestContextJSONErrorsOutFunction · 0.80

Calls 1

newContextFunction · 0.85

Tested by 15

BenchmarkAllocJSONPFunction · 0.64
BenchmarkAllocJSONFunction · 0.64
BenchmarkAllocXMLFunction · 0.64
TestContextEchoFunction · 0.64
TestContextRequestFunction · 0.64
TestContextResponseFunction · 0.64
TestContextStreamFunction · 0.64
TestContextJSONFunction · 0.64
TestContextJSONErrorsOutFunction · 0.64