http

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// HeaderAccept 是接受标标识.
	HeaderAccept = http.CanonicalHeaderKey("Accept")
	// HeaderContentType 是内容类型标识.
	HeaderContentType = http.CanonicalHeaderKey("Content-Type")
	// HeaderAcceptLanguage 是接受语言标识.
	HeaderAcceptLanguage = http.CanonicalHeaderKey("Accept-Language")
)

Functions

func ContentSubtype

func ContentSubtype(contentType string) string

ContentSubtype 返回给定内容类型的content-subtype. 给定的content-type必须是以开头的有效content-type,但不会返回content-subtype.

根据RFC7231. contentType的变量名假定都是小写字母.

func ContentType

func ContentType(subtype string) string

ContentType 返回带有基本前缀的内容类型.

func GRPCCodeFromStatus

func GRPCCodeFromStatus(code int) codes.Code

GRPCCodeFromStatus 将HTTP错误代码转换为相应的gRPC响应状态. See: https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto

func StatusFromGRPCCode

func StatusFromGRPCCode(code codes.Code) int

StatusFromGRPCCode 将gRPC错误代码转换为相应的HTTP响应状态. See: https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto

Types

This section is empty.

Jump to

Keyboard shortcuts

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