Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMethodEmpty = errors.New("method is empty") ErrURLEmpty = errors.New("url is empty") )
Functions ¶
This section is empty.
Types ¶
type MarshalError ¶
func (MarshalError) Error ¶
func (e MarshalError) Error() string
type Middleware ¶
type PayloadSender ¶
type PayloadSender interface { // Query methods Query(name, value string) PayloadSender AddQuery(key, value string) PayloadSender DelQuery(name string) PayloadSender QueryString(q string) PayloadSender Queries(queries url.Values) PayloadSender QueryObject(q any) PayloadSender // Header methods Header(name, value string, uncanonical ...bool) PayloadSender AddHeader(name, value string, uncanonical ...bool) PayloadSender DelHeader(name string) PayloadSender Headers(header http.Header) PayloadSender UserAgent(ua string) PayloadSender // Auth methods BasicAuth(username, password string) PayloadSender BearerAuth(token string) PayloadSender CustomAuth(scheme, token string) PayloadSender // Cache-Control methods CacheControl(directives ...string) PayloadSender IfModifiedSince(t time.Time) PayloadSender IfUnmodifiedSince(t time.Time) PayloadSender IfNoneMatch(etag string) PayloadSender IfMatch(etags ...string) PayloadSender // Cookie methods Cookie(cookie *http.Cookie) PayloadSender AddCookie(cookie *http.Cookie) PayloadSender DelCookie(cookie *http.Cookie) PayloadSender Cookies(cookies ...*http.Cookie) PayloadSender // Body methods Body(body io.Reader, contentType string) PayloadSender BytesBody(body []byte, contentType string) PayloadSender TextBody(body string, contentType string) PayloadSender FormBody(form url.Values) PayloadSender FormObjectBody(body any) PayloadSender ObjectBody(body any, marshal func(any) ([]byte, error), contentType string) PayloadSender JSONBody(body any) PayloadSender XMLBody(body any) PayloadSender ProtobufBody(body proto.Message) PayloadSender GobBody(body any) PayloadSender MultipartBody(formData ...*FormData) PayloadSender // other methods Middleware(middlewares ...Middleware) PayloadSender Build(ctx context.Context) (*http.Request, error) Send(ctx context.Context, clis ...*http.Client) (ResponseReceiver, error) }
type RequestSender ¶
type RequestSender interface { Method(method string) URLSender Get() URLSender Head() URLSender Post() URLSender Put() URLSender Patch() URLSender Delete() URLSender Connect() URLSender Options() URLSender Trace() URLSender }
func Sender ¶
func Sender() RequestSender
type ResponseReceiver ¶
type ResponseReceiver interface { Response() *http.Response Status() string StatusCode() int Proto() string ProtoMajor() int ProtoMinor() int ContentLength() int64 TransferEncoding() []string Headers() http.Header Trailers() http.Header Cookies() []*http.Cookie BytesBody() ([]byte, error) TextBody() (string, error) ObjectBody(body any, unmarshal func([]byte, any) error) error JSONBody(body any) error XMLBody(body any) error ProtobufBody(body proto.Message) error GobBody(body any) error WriterBody(file io.Writer) error }
func Receiver ¶
func Receiver(resp *http.Response) ResponseReceiver
type URLSender ¶
type URLSender interface { URL(uri *url.URL) PayloadSender URLString(urlString string) PayloadSender }
type UnmarshalError ¶
func (UnmarshalError) Error ¶
func (e UnmarshalError) Error() string
Click to show internal directories.
Click to hide internal directories.