httputil

package
v0.0.0-...-2910145 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

httputil 包提供内部使用的HTTP功能。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildParams

func BuildParams(params interface{}, noUrlEncode ...bool) (encodedParamStr string)

BuildParams 为 http 客户端构建请求字符串。`params` 参数可以是以下类型: string/[]byte/map/struct/*struct。

可选参数 `noUrlEncode` 指定是否忽略数据的 URL 编码。 详细解释: 此 Go 语言注释描述了一个名为 `BuildParams` 的函数,该函数用于根据给定的参数构建一个 HTTP 客户端的请求字符串。`params` 参数支持多种数据类型,包括但不限于:字符串(string)、字节切片([]byte)、映射(map)、结构体(struct)以及指向结构体的指针(*struct)。 另外,该函数接受一个可选参数 `noUrlEncode`,这个布尔类型的参数决定了在构建请求字符串时是否跳过对数据进行 URL 编码处理。如果设为 `true`,则表示不进行 URL 编码;否则(默认情况或设为 `false`),将对数据进行 URL 编码。

func HeaderToMap

func HeaderToMap(header http.Header) map[string]interface{}

HeaderToMap 将请求头转换为映射(map)。

Types

This section is empty.

Jump to

Keyboard shortcuts

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