Documentation ¶
Index ¶
- Constants
- func CompressHandler(h http.Handler) http.Handler
- func JSONOut(w http.ResponseWriter, out interface{})
- func MockAuthServer(opts ...MockServerRouterOption) (server *httptest.Server, closer func())
- func ResponseSnapshotMiddleware(snapshots *[]*ResponseSnapshot) mux.MiddlewareFunc
- type MockServerRouterOption
- type ResponseSnapshot
Constants ¶
View Source
const ( DefaultToken = "privatisation" RefreshToken = "privaterefresh" )
Variables ¶
This section is empty.
Functions ¶
func CompressHandler ¶
CompressHandler only using for testing, mod from gorilla/handlers/CompressHandler.
func JSONOut ¶
func JSONOut(w http.ResponseWriter, out interface{})
JSONOut using to encode payload as json format.
func MockAuthServer ¶
func MockAuthServer(opts ...MockServerRouterOption) (server *httptest.Server, closer func())
MockAuthServer creates new test http server with listening port 52345.
func ResponseSnapshotMiddleware ¶
func ResponseSnapshotMiddleware(snapshots *[]*ResponseSnapshot) mux.MiddlewareFunc
ResponseSnapshotMiddleware will snapshotting handlers response and append to give snapshots slice.
Types ¶
type MockServerRouterOption ¶
MockServerRouterOption used to customized http routers, you can use this type to register your handlers on mock serer.
The second argument called ctx is server provided global state key-value cache, you can use this cache to store customized variables in multiple requests.
func WithBuiltinTestDataEndpoints ¶
func WithBuiltinTestDataEndpoints() MockServerRouterOption
WithBuiltinTestDataEndpoints creates simple data endpoints and register to router.
Click to show internal directories.
Click to hide internal directories.