httpkit

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderAuth = "Authorization"
	HeaderType = "Content-Type"
	HeaderJson = "application/json"
	HeaderUrl  = "application/x-www-form-urlencoded"
)

一些常用的标准头

Variables

View Source
var DefaultClient = &http.Client{
	Transport: &http.Transport{
		DialContext: (&net.Dialer{
			Timeout: 90 * time.Second,
		}).DialContext,
		TLSHandshakeTimeout:   90 * time.Second,
		ResponseHeaderTimeout: 90 * time.Second,
		MaxIdleConnsPerHost:   16,
	},
	Timeout: 90 * time.Second,
}

Functions

func HttpDo added in v1.7.9

func HttpDo(base *WebBase, resp any) error

func WebDo

func WebDo(base *WebBase) ([]byte, error)

http 请求的工具函数

Types

type WebBase

type WebBase struct {
	Url    string            // 请求地址
	Method string            // 请求方法
	Header map[string]string // 请求头
	Body   io.Reader         // 请求体
}

Jump to

Keyboard shortcuts

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