Documentation
¶
Index ¶
- func NewJSONRequest(ctx context.Context, method, url string, data interface{}) (*http.Request, error)
- func NewTestService(desc ...definition.Descriptor) (service.Service, error)
- func NewTestServiceWithConfig(desc []definition.Descriptor, modifier service.DefinitionModifier, ...) (service.Service, error)
- type ResponseWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewJSONRequest ¶
func NewJSONRequest(ctx context.Context, method, url string, data interface{}) (*http.Request, error)
NewJSONRequest creates a http.Request with json Content-Type. The data parameter can be io.Reader, []byte or a struct.
func NewTestService ¶
func NewTestService(desc ...definition.Descriptor) (service.Service, error)
NewTestService creates a service.Service for testing.
func NewTestServiceWithConfig ¶
func NewTestServiceWithConfig(desc []definition.Descriptor, modifier service.DefinitionModifier, filters []service.Filter) (service.Service, error)
NewTestServiceWithConfig creates a service.Service for testing with user specified modifier and filters. If modifier or filters is nil, default option will be used.
Types ¶
type ResponseWriter ¶
type ResponseWriter interface { http.ResponseWriter Code() int Bytes() []byte }
ResponseWriter mocks http.ResponseWriter and records response for testing
func NewResponseWriter ¶
func NewResponseWriter() ResponseWriter
NewResponseWriter creates a new ResponseWriter
Click to show internal directories.
Click to hide internal directories.