httpUtil

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentTypeJson     = "json"
	ContentTypeFormData = "form-data"
	ContentTypeSSML     = "application/ssml+xml"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicAuth

type BasicAuth struct {
	Username string
	Password string
}

type ReqParamsOption

type ReqParamsOption func(*requestParamsDto)

func SetBasicAuth

func SetBasicAuth(username, password string) ReqParamsOption

func WithContentType

func WithContentType(contentType string) ReqParamsOption

func WithReqHeader

func WithReqHeader(header http.Header) ReqParamsOption

func WithTimeout

func WithTimeout(millionSecond uint32) ReqParamsOption

type ResponseDto

type ResponseDto struct {
	Body []byte
	Err  error
}

func Delete

func Delete(ctx context.Context, url string, params map[string]any, opts ...ReqParamsOption) *ResponseDto

func Get

func Get(ctx context.Context, url string, params map[string]any, opts ...ReqParamsOption) *ResponseDto

Get 返回结果json化,并只取了result或data

func Post

func Post(ctx context.Context, url string, params map[string]any, opts ...ReqParamsOption) *ResponseDto

Post 返回结果json化,并只取了result或data

func (*ResponseDto) Result

func (r *ResponseDto) Result() ([]byte, error)

Jump to

Keyboard shortcuts

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