Documentation
¶
Index ¶
- type MockedHTTPContext
- func (c *MockedHTTPContext) AddLazyTag(lazyTag func() string)
- func (c *MockedHTTPContext) AddTag(tag string)
- func (c *MockedHTTPContext) CallNextHandler(lastResult string) string
- func (c *MockedHTTPContext) Cancel(err error)
- func (c *MockedHTTPContext) Cancelled() bool
- func (c *MockedHTTPContext) ClientDisconnected() bool
- func (c *MockedHTTPContext) Deadline() (deadline time.Time, ok bool)
- func (c *MockedHTTPContext) Done() <-chan struct{}
- func (c *MockedHTTPContext) Err() error
- func (c *MockedHTTPContext) Finish()
- func (c *MockedHTTPContext) Lock()
- func (c *MockedHTTPContext) OnFinish(fn context.FinishFunc)
- func (c *MockedHTTPContext) Protocol() context.Protocol
- func (c *MockedHTTPContext) Request() context.HTTPRequest
- func (c *MockedHTTPContext) Response() context.HTTPResponse
- func (c *MockedHTTPContext) SaveReqToTemplate(filterName string) error
- func (c *MockedHTTPContext) SaveRspToTemplate(filterName string) error
- func (c *MockedHTTPContext) SetHandlerCaller(caller context.HandlerCaller)
- func (c *MockedHTTPContext) SetTemplate(ht *context.HTTPTemplate)
- func (c *MockedHTTPContext) Span() tracing.Span
- func (c *MockedHTTPContext) StatMetric() *httpstat.Metric
- func (c *MockedHTTPContext) Template() texttemplate.TemplateEngine
- func (c *MockedHTTPContext) Unlock()
- func (c *MockedHTTPContext) Value(key interface{}) interface{}
- type MockedHTTPRequest
- func (r *MockedHTTPRequest) AddCookie(cookie *http.Cookie)
- func (r *MockedHTTPRequest) Body() io.Reader
- func (r *MockedHTTPRequest) Cookie(name string) (*http.Cookie, error)
- func (r *MockedHTTPRequest) Cookies() []*http.Cookie
- func (r *MockedHTTPRequest) EscapedPath() string
- func (r *MockedHTTPRequest) Fragment() string
- func (r *MockedHTTPRequest) Header() *httpheader.HTTPHeader
- func (r *MockedHTTPRequest) Host() string
- func (r *MockedHTTPRequest) Method() string
- func (r *MockedHTTPRequest) Path() string
- func (r *MockedHTTPRequest) Proto() string
- func (r *MockedHTTPRequest) Query() string
- func (r *MockedHTTPRequest) RealIP() string
- func (r *MockedHTTPRequest) Scheme() string
- func (r *MockedHTTPRequest) SetBody(body io.Reader, closePreviousReader bool)
- func (r *MockedHTTPRequest) SetHost(host string)
- func (r *MockedHTTPRequest) SetMethod(method string)
- func (r *MockedHTTPRequest) SetPath(path string)
- func (r *MockedHTTPRequest) SetQuery(query string)
- func (r *MockedHTTPRequest) Size() uint64
- func (r *MockedHTTPRequest) Std() *http.Request
- type MockedHTTPResponse
- func (r *MockedHTTPResponse) Body() io.Reader
- func (r *MockedHTTPResponse) Header() *httpheader.HTTPHeader
- func (r *MockedHTTPResponse) OnFlushBody(fn context.BodyFlushFunc)
- func (r *MockedHTTPResponse) SetBody(body io.Reader)
- func (r *MockedHTTPResponse) SetCookie(cookie *http.Cookie)
- func (r *MockedHTTPResponse) SetStatusCode(code int)
- func (r *MockedHTTPResponse) Size() uint64
- func (r *MockedHTTPResponse) StatusCode() int
- func (r *MockedHTTPResponse) Std() http.ResponseWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockedHTTPContext ¶
type MockedHTTPContext struct {
MockedLock func()
MockedUnlock func()
MockedSpan func() tracing.Span
MockedRequest MockedHTTPRequest
MockedResponse MockedHTTPResponse
MockedDeadline func() (time.Time, bool)
MockedDone func() <-chan struct{}
MockedErr func() error
MockedValue func(key interface{}) interface{}
MockedCancel func(err error)
MockedCancelled func() bool
MockedClientDisconnected func() bool
MockedOnFinish func(func())
MockedAddTag func(tag string)
MockedAddLazyTag func(func() string)
MockedStatMetric func() *httpstat.Metric
MockedFinish func()
MockedTemplate func() texttemplate.TemplateEngine
MockedSetTemplate func(ht *context.HTTPTemplate)
MockedSaveReqToTemplate func(filterName string) error
MockedSaveRspToTemplate func(filterName string) error
MockedCallNextHandler func(lastResult string) string
MockedSetHandlerCaller func(caller context.HandlerCaller)
// contains filtered or unexported fields
}
MockedHTTPContext is the mocked HTTP context
func (*MockedHTTPContext) AddLazyTag ¶ added in v1.4.1
func (c *MockedHTTPContext) AddLazyTag(lazyTag func() string)
AddLazyTag mocks the AddLazyTag function of HTTPContext
func (*MockedHTTPContext) AddTag ¶
func (c *MockedHTTPContext) AddTag(tag string)
AddTag mocks the AddTag function of HTTPContext
func (*MockedHTTPContext) CallNextHandler ¶
func (c *MockedHTTPContext) CallNextHandler(lastResult string) string
CallNextHandler mocks the CallNextHandler function of HTTPContext
func (*MockedHTTPContext) Cancel ¶
func (c *MockedHTTPContext) Cancel(err error)
Cancel mocks the Cancel function of HTTPContext
func (*MockedHTTPContext) Cancelled ¶
func (c *MockedHTTPContext) Cancelled() bool
Cancelled mocks the Cancelled function of HTTPContext
func (*MockedHTTPContext) ClientDisconnected ¶
func (c *MockedHTTPContext) ClientDisconnected() bool
ClientDisconnected mocks the ClientDisconnected function of HTTPContext
func (*MockedHTTPContext) Deadline ¶
func (c *MockedHTTPContext) Deadline() (deadline time.Time, ok bool)
Deadline mocks the Deadline function of HTTPContext
func (*MockedHTTPContext) Done ¶
func (c *MockedHTTPContext) Done() <-chan struct{}
Done mocks the Done function of HTTPContext
func (*MockedHTTPContext) Err ¶
func (c *MockedHTTPContext) Err() error
Err mocks the Err function of HTTPContext
func (*MockedHTTPContext) Finish ¶
func (c *MockedHTTPContext) Finish()
Finish mocks the Finish function of HTTPContext
func (*MockedHTTPContext) Lock ¶
func (c *MockedHTTPContext) Lock()
Lock mocks the Lock function of HTTPContext
func (*MockedHTTPContext) OnFinish ¶
func (c *MockedHTTPContext) OnFinish(fn context.FinishFunc)
OnFinish mocks the OnFinish function of HTTPContext
func (*MockedHTTPContext) Protocol ¶ added in v1.4.1
func (c *MockedHTTPContext) Protocol() context.Protocol
Protocol return protocol of MockedHTTPContext
func (*MockedHTTPContext) Request ¶
func (c *MockedHTTPContext) Request() context.HTTPRequest
Request mocks the Request function of HTTPContext
func (*MockedHTTPContext) Response ¶
func (c *MockedHTTPContext) Response() context.HTTPResponse
Response mocks the Response function of HTTPContext
func (*MockedHTTPContext) SaveReqToTemplate ¶
func (c *MockedHTTPContext) SaveReqToTemplate(filterName string) error
SaveReqToTemplate mocks the SaveReqToTemplate function of HTTPContext
func (*MockedHTTPContext) SaveRspToTemplate ¶
func (c *MockedHTTPContext) SaveRspToTemplate(filterName string) error
SaveRspToTemplate mocks the SaveRspToTemplate function of HTTPContext
func (*MockedHTTPContext) SetHandlerCaller ¶
func (c *MockedHTTPContext) SetHandlerCaller(caller context.HandlerCaller)
SetHandlerCaller mocks the SetHandlerCaller function of HTTPContext
func (*MockedHTTPContext) SetTemplate ¶
func (c *MockedHTTPContext) SetTemplate(ht *context.HTTPTemplate)
SetTemplate mocks the SetTemplate function of HTTPContext
func (*MockedHTTPContext) Span ¶
func (c *MockedHTTPContext) Span() tracing.Span
Span mocks the Span function of HTTPContext
func (*MockedHTTPContext) StatMetric ¶
func (c *MockedHTTPContext) StatMetric() *httpstat.Metric
StatMetric mocks the StatMetric function of HTTPContext
func (*MockedHTTPContext) Template ¶
func (c *MockedHTTPContext) Template() texttemplate.TemplateEngine
Template mocks the Template function of HTTPContext
func (*MockedHTTPContext) Unlock ¶
func (c *MockedHTTPContext) Unlock()
Unlock mocks the Unlock function of HTTPContext
func (*MockedHTTPContext) Value ¶
func (c *MockedHTTPContext) Value(key interface{}) interface{}
Value mocks the Value function of HTTPContext
type MockedHTTPRequest ¶
type MockedHTTPRequest struct {
MockedRealIP func() string
MockedMethod func() string
MockedSetMethod func(method string)
MockedScheme func() string
MockedHost func() string
MockedSetHost func(host string)
MockedPath func() string
MockedSetPath func(path string)
MockedEscapedPath func() string
MockedQuery func() string
MockedSetQuery func(query string)
MockedFragment func() string
MockedProto func() string
MockedHeader func() *httpheader.HTTPHeader
MockedCookie func(name string) (*http.Cookie, error)
MockedCookies func() []*http.Cookie
MockedAddCookie func(cookie *http.Cookie)
MockedBody func() io.Reader
MockedSetBody func(io.Reader, bool)
MockedStd func() *http.Request
MockedSize func() uint64
}
MockedHTTPRequest is the mocked HTTP request
func (*MockedHTTPRequest) AddCookie ¶
func (r *MockedHTTPRequest) AddCookie(cookie *http.Cookie)
AddCookie mocks the AddCookie function of HTTPRequest
func (*MockedHTTPRequest) Body ¶
func (r *MockedHTTPRequest) Body() io.Reader
Body mocks the Body function of HTTPRequest
func (*MockedHTTPRequest) Cookie ¶
func (r *MockedHTTPRequest) Cookie(name string) (*http.Cookie, error)
Cookie mocks the Cookie function of HTTPRequest
func (*MockedHTTPRequest) Cookies ¶
func (r *MockedHTTPRequest) Cookies() []*http.Cookie
Cookies mocks the Cookies function of HTTPRequest
func (*MockedHTTPRequest) EscapedPath ¶
func (r *MockedHTTPRequest) EscapedPath() string
EscapedPath mocks the EscapedPath function of HTTPRequest
func (*MockedHTTPRequest) Fragment ¶
func (r *MockedHTTPRequest) Fragment() string
Fragment mocks the Fragment function of HTTPRequest
func (*MockedHTTPRequest) Header ¶
func (r *MockedHTTPRequest) Header() *httpheader.HTTPHeader
Header mocks the Header function of HTTPRequest
func (*MockedHTTPRequest) Host ¶
func (r *MockedHTTPRequest) Host() string
Host mocks the Host function of HTTPRequest
func (*MockedHTTPRequest) Method ¶
func (r *MockedHTTPRequest) Method() string
Method mocks the Method function of HTTPRequest
func (*MockedHTTPRequest) Path ¶
func (r *MockedHTTPRequest) Path() string
Path mocks the Path function of HTTPRequest
func (*MockedHTTPRequest) Proto ¶
func (r *MockedHTTPRequest) Proto() string
Proto mocks the Proto function of HTTPRequest
func (*MockedHTTPRequest) Query ¶
func (r *MockedHTTPRequest) Query() string
Query mocks the Query function of HTTPRequest
func (*MockedHTTPRequest) RealIP ¶
func (r *MockedHTTPRequest) RealIP() string
RealIP mocks the RealIP function of HTTPRequest
func (*MockedHTTPRequest) Scheme ¶
func (r *MockedHTTPRequest) Scheme() string
Scheme mocks the Scheme function of HTTPRequest
func (*MockedHTTPRequest) SetBody ¶
func (r *MockedHTTPRequest) SetBody(body io.Reader, closePreviousReader bool)
SetBody mocks the SetBody function of HTTPRequest
func (*MockedHTTPRequest) SetHost ¶
func (r *MockedHTTPRequest) SetHost(host string)
SetHost mocks the SetHost function of HTTPRequest
func (*MockedHTTPRequest) SetMethod ¶
func (r *MockedHTTPRequest) SetMethod(method string)
SetMethod mocks the SetMethod function of HTTPRequest
func (*MockedHTTPRequest) SetPath ¶
func (r *MockedHTTPRequest) SetPath(path string)
SetPath mocks the SetPath function of HTTPRequest
func (*MockedHTTPRequest) SetQuery ¶
func (r *MockedHTTPRequest) SetQuery(query string)
SetQuery mocks the SetQuery function of HTTPRequest
func (*MockedHTTPRequest) Size ¶
func (r *MockedHTTPRequest) Size() uint64
Size mocks the Size function of HTTPRequest
func (*MockedHTTPRequest) Std ¶
func (r *MockedHTTPRequest) Std() *http.Request
Std mocks the Std function of HTTPRequest
type MockedHTTPResponse ¶
type MockedHTTPResponse struct {
MockedStatusCode func() int
MockedSetStatusCode func(code int)
MockedHeader func() *httpheader.HTTPHeader
MockedSetCookie func(cookie *http.Cookie)
MockedSetBody func(body io.Reader)
MockedBody func() io.Reader
MockedOnFlushBody func(fn context.BodyFlushFunc)
MockedStd func() http.ResponseWriter
MockedSize func() uint64
}
MockedHTTPResponse is the mocked HTTP response
func (*MockedHTTPResponse) Body ¶
func (r *MockedHTTPResponse) Body() io.Reader
Body returns the response body
func (*MockedHTTPResponse) Header ¶
func (r *MockedHTTPResponse) Header() *httpheader.HTTPHeader
Header returns the header
func (*MockedHTTPResponse) OnFlushBody ¶
func (r *MockedHTTPResponse) OnFlushBody(fn context.BodyFlushFunc)
OnFlushBody registers a callback function on flush body
func (*MockedHTTPResponse) SetBody ¶
func (r *MockedHTTPResponse) SetBody(body io.Reader)
SetBody sets the response body
func (*MockedHTTPResponse) SetCookie ¶
func (r *MockedHTTPResponse) SetCookie(cookie *http.Cookie)
SetCookie sets a cookie
func (*MockedHTTPResponse) SetStatusCode ¶
func (r *MockedHTTPResponse) SetStatusCode(code int)
SetStatusCode set the status code
func (*MockedHTTPResponse) Size ¶
func (r *MockedHTTPResponse) Size() uint64
Size returns the response size
func (*MockedHTTPResponse) StatusCode ¶
func (r *MockedHTTPResponse) StatusCode() int
StatusCode returns the status code
func (*MockedHTTPResponse) Std ¶
func (r *MockedHTTPResponse) Std() http.ResponseWriter
Std returns the standard response