Documentation ¶
Index ¶
- Constants
- Variables
- func BinPath() string
- func CaseToRequest(api *Api, c Case) *fasthttp.Request
- func Green(format string, args ...interface{}) string
- func IsExpected(expectedType, value string, resp *fasthttp.Response) bool
- func Red(format string, args ...interface{}) string
- func Yellow(format string, args ...interface{}) string
- type Api
- type Case
- type Conf
- type ReadWriter
- func (rw *ReadWriter) Close() error
- func (rw *ReadWriter) LocalAddr() net.Addr
- func (rw *ReadWriter) Read(b []byte) (int, error)
- func (rw *ReadWriter) RemoteAddr() net.Addr
- func (rw *ReadWriter) Request(req *fasthttp.Request, resp *fasthttp.Response) (err error)
- func (rw *ReadWriter) SetDeadline(t time.Time) error
- func (rw *ReadWriter) SetReadDeadline(t time.Time) error
- func (rw *ReadWriter) SetWriteDeadline(t time.Time) error
- func (rw *ReadWriter) Write(b []byte) (int, error)
- type Unit
Constants ¶
View Source
const ( Equal = `equal` Contains = `contains` Pattern = `pattern` )
Variables ¶
View Source
var ( ErrUnsupportedFileType = errors.New(`unsupported file type`) ErrNotFoundApi = errors.New("not found api") )
Functions ¶
Types ¶
type Api ¶
type Api struct { Desc string `json:"desc" yaml:"desc"` Host string `json:"host" yaml:"host"` Method string `json:"method" yaml:"method"` Path string `json:"path" yaml:"path"` ContentType string `json:"contentType" yaml:"contentType"` Header map[string]string `json:"header" yaml:"header"` CaseList []Case `json:"caseList" yaml:"caseList"` }
type Conf ¶
type Conf struct { ApiList []*Api `json:"apiList" yaml:"apiList"` Delay uint64 `json:"delay" yaml:"delay"` }
func LoadConfByPath ¶
type ReadWriter ¶
func NewReadWriter ¶
func NewReadWriter(server *fasthttp.Server) *ReadWriter
func (*ReadWriter) Close ¶
func (rw *ReadWriter) Close() error
func (*ReadWriter) LocalAddr ¶
func (rw *ReadWriter) LocalAddr() net.Addr
func (*ReadWriter) RemoteAddr ¶
func (rw *ReadWriter) RemoteAddr() net.Addr
func (*ReadWriter) SetDeadline ¶
func (rw *ReadWriter) SetDeadline(t time.Time) error
func (*ReadWriter) SetReadDeadline ¶
func (rw *ReadWriter) SetReadDeadline(t time.Time) error
func (*ReadWriter) SetWriteDeadline ¶
func (rw *ReadWriter) SetWriteDeadline(t time.Time) error
type Unit ¶
type Unit struct {
// contains filtered or unexported fields
}
func NewUnitWithHandler ¶
func NewUnitWithRouter ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.