httputil

package
v0.0.0-...-57f450c Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	UserAgent = "AdsBot-Google (+http://www.google.com/adsbot.html)"
)

Variables

This section is empty.

Functions

func DoRequest

func DoRequest(client *http.Client, req *http.Request) (resp *http.Response, body string, err error)

func DoRequestBytes

func DoRequestBytes(client *http.Client, req *http.Request) (resp *http.Response, body []byte, err error)

func DoRequestJsonDecode

func DoRequestJsonDecode(client *http.Client, req *http.Request, res interface{}) (resp *http.Response, err error)

func EncodeURIComponent

func EncodeURIComponent(str string) string

EncodeURIComponent URLEncode

func Get

func Get(uri string) ([]byte, error)

Get 拉取网页内容

func GetWithJsonDecode

func GetWithJsonDecode(uri string, v interface{}) error

func MakeCommonRequest

func MakeCommonRequest(method string, uri string, contentType ContentType, body []byte) *http.Request

func MakeCommonRequestJson

func MakeCommonRequestJson(method string, uri string, data interface{}) *http.Request

func MakeCommonRequestWithUserAgent

func MakeCommonRequestWithUserAgent(method string, uri string, contentType ContentType, userAgent string, body []byte) *http.Request

func PostForm

func PostForm(uri string, postData url.Values) ([]byte, error)

PostForm 提交FORM类型表单

func PostFormJsonDecode

func PostFormJsonDecode(uri string, postData url.Values, v interface{}) error

func PostJsonWithJsonDecode

func PostJsonWithJsonDecode(uri string, data interface{}, out interface{}) (err error)

PostJsonWithJsonDecode 发送HTTP请求输入输出参数都是json对象

Types

type ContentType

type ContentType string
const (
	ContentTypeJson ContentType = "application/json; charset=utf-8"
	ContentTypeAll  ContentType = "*/*; charset=utf-8"
)

Jump to

Keyboard shortcuts

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