request

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLoadBytesJoiner = &SRequestError{"load bytes joiner"}
	ErrDecodeRequest   = &SRequestError{"decode request"}
	ErrUnknownType     = &SRequestError{"unknown type"}
)

Functions

This section is empty.

Types

type IRequest

type IRequest interface {
	types.IConverter

	GetMethod() string
	GetHost() string
	GetPath() string
	GetHead() map[string]string
	GetBody() []byte
}

func LoadRequest

func LoadRequest(pData interface{}) (IRequest, error)

type IRequestBuilder added in v1.7.7

type IRequestBuilder interface {
	Build() IRequest

	WithMethod(string) IRequestBuilder
	WithHost(string) IRequestBuilder
	WithPath(string) IRequestBuilder
	WithHead(map[string]string) IRequestBuilder
	WithBody([]byte) IRequestBuilder
}

func NewRequestBuilder added in v1.7.7

func NewRequestBuilder() IRequestBuilder

type SRequest

type SRequest struct {
	SRequestBlock
	FBody []byte `json:"body,omitempty"`
}

func (*SRequest) Build added in v1.7.7

func (p *SRequest) Build() IRequest

func (*SRequest) GetBody

func (p *SRequest) GetBody() []byte

func (*SRequest) GetHead

func (p *SRequest) GetHead() map[string]string

func (*SRequest) GetHost

func (p *SRequest) GetHost() string

func (*SRequest) GetMethod

func (p *SRequest) GetMethod() string

func (*SRequest) GetPath

func (p *SRequest) GetPath() string

func (*SRequest) ToBytes

func (p *SRequest) ToBytes() []byte

func (*SRequest) ToString

func (p *SRequest) ToString() string

func (*SRequest) WithBody

func (p *SRequest) WithBody(pBody []byte) IRequestBuilder

func (*SRequest) WithHead

func (p *SRequest) WithHead(pHead map[string]string) IRequestBuilder

func (*SRequest) WithHost

func (p *SRequest) WithHost(pHost string) IRequestBuilder

func (*SRequest) WithMethod

func (p *SRequest) WithMethod(pMethod string) IRequestBuilder

func (*SRequest) WithPath

func (p *SRequest) WithPath(pPath string) IRequestBuilder

type SRequestBlock

type SRequestBlock struct {
	FMethod string            `json:"method,omitempty"`
	FHost   string            `json:"host,omitempty"`
	FPath   string            `json:"path,omitempty"`
	FHead   map[string]string `json:"head,omitempty"`
}

type SRequestError

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

func (*SRequestError) Error

func (err *SRequestError) Error() string

Jump to

Keyboard shortcuts

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