http

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SKIP = errors.New("Skip msg")

Functions

This section is empty.

Types

type Decoder

type Decoder struct {
	Buf *bufio.Reader
	// contains filtered or unexported fields
}

func (*Decoder) Decode

func (d *Decoder) Decode(reader io.Reader, writer io.Writer, opts *decoder.Options) error

func (*Decoder) DecodeHttp

func (d *Decoder) DecodeHttp() (Http, error)

func (*Decoder) SetFilter

func (d *Decoder) SetFilter(filter string)

type Filter

type Filter struct {
	// contains filtered or unexported fields
}

url: /tet & method: get & body: balabal & Content-Type: application/json

func NewFilter

func NewFilter(filterStr string) *Filter

func (*Filter) IsEmpty

func (f *Filter) IsEmpty() bool

func (Filter) String

func (f Filter) String() string

type Http

type Http interface {
	Match(*Filter) bool
	StringHeader() string
	DecodeBody() (string, error)
	RawBody() []byte
}

type HttpReq

type HttpReq struct {
	Method  string
	Url     string
	Version string
	Headers map[string]string
	// contains filtered or unexported fields
}

func (*HttpReq) DecodeBody

func (m *HttpReq) DecodeBody() (string, error)

func (*HttpReq) Match

func (m *HttpReq) Match(filter *Filter) bool

func (*HttpReq) RawBody

func (m *HttpReq) RawBody() []byte

func (*HttpReq) StringHeader

func (m *HttpReq) StringHeader() string

type HttpResp

type HttpResp struct {
	Version    string
	StatusCode int
	StatusMsg  string
	Headers    map[string]string
	// contains filtered or unexported fields
}

func (*HttpResp) DecodeBody

func (m *HttpResp) DecodeBody() (string, error)

func (*HttpResp) Match

func (m *HttpResp) Match(filter *Filter) bool

func (*HttpResp) RawBody

func (m *HttpResp) RawBody() []byte

func (*HttpResp) StringHeader

func (m *HttpResp) StringHeader() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL