httpkit

package
v1.7.5 Latest Latest
Warning

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

Go to latest
Published: May 6, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderAuth = "Authorization"
	HeaderType = "Content-Type"
	HeaderJson = "application/json; charset=UTF-8"
	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 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