Documentation ¶
Index ¶
- func CopyReqBody(b io.ReadCloser) (r1, r2 io.ReadCloser, err error)
- func CopyRespBody(b *bytes.Buffer) (b1, b2 *bytes.Buffer, err error)
- func GetReqBody(cp io.ReadCloser, r *http.Request) string
- func GetRespBody(rec *httptest.ResponseRecorder) string
- func JsonMarshalIndent(data interface{}, prefix, indent string, disableHTMLEscape bool) (string, error)
- type Annotation
- type AnnotationStore
- type BizError
- type BizErrorOption
- type Route
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyReqBody ¶ added in v1.3.5
func CopyReqBody(b io.ReadCloser) (r1, r2 io.ReadCloser, err error)
borrowed from httputil unexported function drainBody
func CopyRespBody ¶ added in v1.3.5
func GetReqBody ¶ added in v1.3.5
func GetReqBody(cp io.ReadCloser, r *http.Request) string
func GetRespBody ¶ added in v1.3.5
func GetRespBody(rec *httptest.ResponseRecorder) string
Types ¶
type Annotation ¶ added in v1.1.7
type AnnotationStore ¶ added in v1.1.7
type AnnotationStore map[string][]Annotation
func (AnnotationStore) GetParams ¶ added in v1.1.7
func (receiver AnnotationStore) GetParams(key string, annotationName string) []string
func (AnnotationStore) HasAnnotation ¶ added in v1.1.7
func (receiver AnnotationStore) HasAnnotation(key string, annotationName string) bool
type BizError ¶ added in v1.3.5
BizError is used for business error implemented error interface StatusCode will be set to http response status code ErrCode is used for business error code ErrMsg is custom error message
func NewBizError ¶ added in v1.3.5
func NewBizError(err error, opts ...BizErrorOption) BizError
NewBizError is factory function for creating an instance of BizError struct
type BizErrorOption ¶ added in v1.3.5
type BizErrorOption func(bizError *BizError)
func WithCause ¶ added in v1.3.5
func WithCause(cause error) BizErrorOption
func WithErrCode ¶ added in v1.3.5
func WithErrCode(errCode int) BizErrorOption
func WithStatusCode ¶ added in v1.3.5
func WithStatusCode(statusCode int) BizErrorOption
Click to show internal directories.
Click to hide internal directories.