httpcli

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClient

func GetClient() *http.Client

Types

type Request

type Request struct {
	URL    string
	Header http.Header
	Params url.Values
	Form   url.Values
	Body   any
}

type Response

type Response struct {
	RawResponse *http.Response
	// contains filtered or unexported fields
}

func Call

func Call(ctx context.Context, req *Request) (*Response, error)

Call 发起 http 请求

func (*Response) Body

func (r *Response) Body() []byte

func (*Response) Cookies

func (r *Response) Cookies() []*http.Cookie

Cookies method to access all the response cookies

func (*Response) FmtBody

func (r *Response) FmtBody(model interface{}) error

FmtBody body bytes 转对象

func (*Response) Header

func (r *Response) Header() http.Header

Header method returns the response headers

func (*Response) IsError

func (r *Response) IsError() bool

func (*Response) IsSuccess

func (r *Response) IsSuccess() bool

func (*Response) Proto

func (r *Response) Proto() string

Proto method returns the HTTP response protocol used for the request.

func (*Response) Size

func (r *Response) Size() int64

func (*Response) Status

func (r *Response) Status() string

func (*Response) StatusCode

func (r *Response) StatusCode() int

func (*Response) String

func (r *Response) String() string

String method returns the body of the server response as String.

Jump to

Keyboard shortcuts

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