package
1.3.48
Repository: https://github.com/sandwich-go/boost.git
Documentation: pkg.go.dev

# README

httputil

HTTP 工具

  • 便捷返回 jsonstringbytes 类型的 GET 数据
  • 支持带缓存的域名解析

例子

str, err := String("https://www.baidu.com/")
xpanic.WhenError(err)
fmt.Println(str)

dc := dns.NewCache()
client := &http.Client{
    Transport: &http.Transport{
        DialContext: dc.GetDialContext(),
    },
}
c := New(client)
str, err = c.String("https://www.baidu.com/")
xpanic.WhenError(err)
fmt.Println(str)

# Packages

No description provided by the author

# Functions

Bytes 使用默认的 Client 发送 GET 请求,返回 bytes 数据.
Get 使用默认的 Client 发送 GET 请求.
JSON 使用默认的 Client 发送 GET 请求,返回 JSON 数据.
New create new an HTTP client.
Post
Post 使用默认的 Client 发送 POST 请求.
SetDefaultHTTPClient 设置默认的 HTTP Client.
SetDefaultTimeout 设置默认的超时时间.
String 使用默认的 Client 发送 GET 请求,返回 string 数据.

# Structs

Error is the custom error type returns from HTTP requests.

# Interfaces

Client HTTP Client 接口.