Documentation ¶
Index ¶
- Constants
- Variables
- func CreateInlineParams(rootKey string, elems ...interface{}) map[string]interface{}
- func CreateInlineTestParams(elems ...interface{}) map[string]interface{}
- func CreateParams(rootKey string, params map[string]interface{}) map[string]interface{}
- func CreateRequest(proxyRoute gobis.ProxyRoute, methods ...string) *http.Request
- type FakeMiddleware
- type FakeMiddlewareParams
- type GobisHandlerTest
- func NewGobisHandlerTest(routes []gobis.ProxyRoute, middlewareHandlers ...gobis.MiddlewareHandler) *GobisHandlerTest
- func NewGobisHandlerTestSsl(routes []gobis.ProxyRoute, inSsl bool, ...) *GobisHandlerTest
- func NewSimpleGobisHandlerTest(routes ...gobis.ProxyRoute) *GobisHandlerTest
- func NewSimpleGobisHandlerTestInSsl(routes ...gobis.ProxyRoute) *GobisHandlerTest
- func (h GobisHandlerTest) Close()
- func (h GobisHandlerTest) GetServerAddr() string
- func (h GobisHandlerTest) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (h GobisHandlerTest) Server(route gobis.ProxyRoute) *PackServer
- func (h GobisHandlerTest) ServerByName(name string) *PackServer
- func (h GobisHandlerTest) ServerFirst() *PackServer
- func (h *GobisHandlerTest) SetBackendHandler(route gobis.ProxyRoute, handler http.Handler)
- func (h *GobisHandlerTest) SetBackendHandlerByName(name string, handler http.Handler)
- func (h *GobisHandlerTest) SetBackendHandlerFirst(handler http.Handler)
- type HandlerParams
- type MiddlewareTest
- func (t *MiddlewareTest) AddMiddlewareParam(rootKey string, key string, value interface{})
- func (t *MiddlewareTest) AddMiddlewareParamToFirst(key string, value interface{})
- func (t *MiddlewareTest) AddMiddlewares(middlewareHandlers ...gobis.MiddlewareHandler)
- func (t *MiddlewareTest) CleanMiddlewares()
- func (t MiddlewareTest) CreateRequest(methods ...string) *http.Request
- func (t MiddlewareTest) ResponseRecorder() *httptest.ResponseRecorder
- func (t MiddlewareTest) ResponseWriter() http.ResponseWriter
- func (t *MiddlewareTest) Run(req *http.Request) *http.Response
- func (t *MiddlewareTest) SetBackendHandler(handler http.Handler)
- func (t *MiddlewareTest) SetMiddlewareParams(middlewareParams interface{})
- func (t *MiddlewareTest) SetMiddlewares(middlewareHandlers []gobis.MiddlewareHandler)
- func (t *MiddlewareTest) SetRoute(route gobis.ProxyRoute)
- type PackServer
- type ParamHandler
- type SimpleTestHandleFunc
- type TestHandler
- type TestHandlerFunc
Constants ¶
View Source
const DEFAULT_HANDLER_RESPONSE = "i'm the backend"
Variables ¶
View Source
var OriginUrl = "http://local.app.com"
Functions ¶
func CreateInlineParams ¶
func CreateInlineTestParams ¶
func CreateInlineTestParams(elems ...interface{}) map[string]interface{}
func CreateParams ¶
func CreateRequest ¶
func CreateRequest(proxyRoute gobis.ProxyRoute, methods ...string) *http.Request
Types ¶
type FakeMiddleware ¶
type FakeMiddleware struct {
// contains filtered or unexported fields
}
func NewFakeMiddleware ¶
func NewFakeMiddleware(testHandler TestHandler) *FakeMiddleware
func (FakeMiddleware) Handler ¶
func (m FakeMiddleware) Handler(route gobis.ProxyRoute, params interface{}, next http.Handler) (http.Handler, error)
func (FakeMiddleware) Schema ¶
func (m FakeMiddleware) Schema() interface{}
type FakeMiddlewareParams ¶
type FakeMiddlewareParams struct {
TestParams interface{} `mapstructure:"test_params" json:"test_params" yaml:"test_params"`
}
type GobisHandlerTest ¶
type GobisHandlerTest struct {
// contains filtered or unexported fields
}
func NewGobisHandlerTest ¶
func NewGobisHandlerTest(routes []gobis.ProxyRoute, middlewareHandlers ...gobis.MiddlewareHandler) *GobisHandlerTest
func NewGobisHandlerTestSsl ¶
func NewGobisHandlerTestSsl(routes []gobis.ProxyRoute, inSsl bool, middlewareHandlers ...gobis.MiddlewareHandler) *GobisHandlerTest
func NewSimpleGobisHandlerTest ¶
func NewSimpleGobisHandlerTest(routes ...gobis.ProxyRoute) *GobisHandlerTest
func NewSimpleGobisHandlerTestInSsl ¶
func NewSimpleGobisHandlerTestInSsl(routes ...gobis.ProxyRoute) *GobisHandlerTest
func (GobisHandlerTest) Close ¶
func (h GobisHandlerTest) Close()
func (GobisHandlerTest) GetServerAddr ¶
func (h GobisHandlerTest) GetServerAddr() string
func (GobisHandlerTest) ServeHTTP ¶
func (h GobisHandlerTest) ServeHTTP(w http.ResponseWriter, req *http.Request)
func (GobisHandlerTest) Server ¶
func (h GobisHandlerTest) Server(route gobis.ProxyRoute) *PackServer
func (GobisHandlerTest) ServerByName ¶
func (h GobisHandlerTest) ServerByName(name string) *PackServer
func (GobisHandlerTest) ServerFirst ¶
func (h GobisHandlerTest) ServerFirst() *PackServer
func (*GobisHandlerTest) SetBackendHandler ¶
func (h *GobisHandlerTest) SetBackendHandler(route gobis.ProxyRoute, handler http.Handler)
func (*GobisHandlerTest) SetBackendHandlerByName ¶
func (h *GobisHandlerTest) SetBackendHandlerByName(name string, handler http.Handler)
func (*GobisHandlerTest) SetBackendHandlerFirst ¶
func (h *GobisHandlerTest) SetBackendHandlerFirst(handler http.Handler)
type HandlerParams ¶
type HandlerParams struct { W http.ResponseWriter Req *http.Request Params FakeMiddlewareParams Next http.Handler Route gobis.ProxyRoute }
type MiddlewareTest ¶
type MiddlewareTest struct {
// contains filtered or unexported fields
}
func NewMiddlewareTest ¶
func NewMiddlewareTest(route gobis.ProxyRoute, backendHandler http.Handler, middlewareHandlers ...gobis.MiddlewareHandler) *MiddlewareTest
func NewSimpleMiddlewareTest ¶
func NewSimpleMiddlewareTest(middlewareParams interface{}, middlewareHandlers ...gobis.MiddlewareHandler) *MiddlewareTest
func (*MiddlewareTest) AddMiddlewareParam ¶
func (t *MiddlewareTest) AddMiddlewareParam(rootKey string, key string, value interface{})
func (*MiddlewareTest) AddMiddlewareParamToFirst ¶
func (t *MiddlewareTest) AddMiddlewareParamToFirst(key string, value interface{})
func (*MiddlewareTest) AddMiddlewares ¶
func (t *MiddlewareTest) AddMiddlewares(middlewareHandlers ...gobis.MiddlewareHandler)
func (*MiddlewareTest) CleanMiddlewares ¶
func (t *MiddlewareTest) CleanMiddlewares()
func (MiddlewareTest) CreateRequest ¶
func (t MiddlewareTest) CreateRequest(methods ...string) *http.Request
func (MiddlewareTest) ResponseRecorder ¶
func (t MiddlewareTest) ResponseRecorder() *httptest.ResponseRecorder
func (MiddlewareTest) ResponseWriter ¶
func (t MiddlewareTest) ResponseWriter() http.ResponseWriter
func (*MiddlewareTest) SetBackendHandler ¶
func (t *MiddlewareTest) SetBackendHandler(handler http.Handler)
func (*MiddlewareTest) SetMiddlewareParams ¶
func (t *MiddlewareTest) SetMiddlewareParams(middlewareParams interface{})
func (*MiddlewareTest) SetMiddlewares ¶
func (t *MiddlewareTest) SetMiddlewares(middlewareHandlers []gobis.MiddlewareHandler)
func (*MiddlewareTest) SetRoute ¶
func (t *MiddlewareTest) SetRoute(route gobis.ProxyRoute)
type PackServer ¶
type PackServer struct { Handler *ParamHandler Server *httptest.Server Name string }
func CreateBackendServer ¶
func CreateBackendServer(name string) *PackServer
func (*PackServer) SetHandler ¶
func (p *PackServer) SetHandler(handler http.Handler)
type ParamHandler ¶
func (ParamHandler) ServeHTTP ¶
func (h ParamHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)
type SimpleTestHandleFunc ¶
type SimpleTestHandleFunc func(http.ResponseWriter, *http.Request, FakeMiddlewareParams)
func (SimpleTestHandleFunc) ServeHTTP ¶
func (h SimpleTestHandleFunc) ServeHTTP(p HandlerParams)
type TestHandler ¶
type TestHandler interface {
ServeHTTP(HandlerParams)
}
type TestHandlerFunc ¶
type TestHandlerFunc func(HandlerParams)
func (TestHandlerFunc) ServeHTTP ¶
func (f TestHandlerFunc) ServeHTTP(p HandlerParams)
Click to show internal directories.
Click to hide internal directories.