Documentation ¶
Index ¶
- func RequestWithSignedInUser(req *http.Request, usr *user.SignedInUser) *http.Request
- func RequestWithWebContext(req *http.Request, c *contextmodel.ReqContext) *http.Request
- type Context
- type Middleware
- type Server
- func (s *Server) NewGetRequest(target string) *http.Request
- func (s *Server) NewPostRequest(target string, body io.Reader) *http.Request
- func (s *Server) NewRequest(method string, target string, body io.Reader) *http.Request
- func (s *Server) Send(req *http.Request) (*http.Response, error)
- func (s *Server) SendJSON(req *http.Request) (*http.Response, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RequestWithSignedInUser ¶
func RequestWithWebContext ¶
func RequestWithWebContext(req *http.Request, c *contextmodel.ReqContext) *http.Request
Types ¶
type Context ¶
func MiddlewareContext ¶
func MiddlewareContext(test Middleware, req *http.Request) *Context
MiddlewareContext returns a *http.Request, http.ResponseWriter and http.Handler exactly as if it was passed to a middleware
type Middleware ¶
type Middleware struct { // Before are run ahead of the returned context Before []web.Handler // After are part of the http.Handler chain After []web.Handler // The actual handler at the end of the chain Handler web.Handler }
Middleware is a utility for testing middlewares
type Server ¶
type Server struct { Mux *web.Mux RouteRegister routing.RouteRegister TestServer *httptest.Server // contains filtered or unexported fields }
func NewServer ¶
func NewServer(t testing.TB, routeRegister routing.RouteRegister) *Server
NewServer starts and returns a new server.
func (*Server) NewGetRequest ¶
NewGetRequest creates a new GET request setup for test.
func (*Server) NewPostRequest ¶
NewPostRequest creates a new POST request setup for test.
func (*Server) NewRequest ¶
NewRequest creates a new request setup for test.
Click to show internal directories.
Click to hide internal directories.