httpx

package
v0.0.0-...-3839eb7 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DescribeJson

func DescribeJson(reader io.Reader) (map[string]any, error)

func DescribeRawJson

func DescribeRawJson(reader io.Reader) ([]byte, error)

func GetAcceptLanguage

func GetAcceptLanguage(ctx *gin.Context) []string

GetAcceptLanguage the header should compliance with regulations follow Accept-Language: de Accept-Language: de-CH Accept-Language: en-US,en;q=0.5 Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2 https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Headers/Accept-Language

func GetBearerToken

func GetBearerToken(authHeader string) string

func GetBearerTokenFromCtx

func GetBearerTokenFromCtx(ctx *gin.Context) string

GetBearerTokenFromCtx get bearer token from Authorization Header param ctx *gin.Context return string

func GetFirstAcceptLanguage

func GetFirstAcceptLanguage(ctx *gin.Context) string

func GetQualityValuePairs

func GetQualityValuePairs(header string) []string

GetQualityValuePairs return http quality value pairs ordered by quality from string eg: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

-> [text/html application/xhtml+xml application/xml */*]

reference https://developer.mozilla.org/zh-CN/docs/Glossary/Quality_values

func GetRequestContentType

func GetRequestContentType(ctx *gin.Context) string

func GetRequestId

func GetRequestId(ctx *gin.Context) (requestId string)

func GetResponseContentType

func GetResponseContentType(ctx *gin.Context) string

func SetRequestId

func SetRequestId(ctx *gin.Context, id string)

Types

type Cors

type Cors struct {
	Enabled          bool     `mapstructure:"enable"`
	AllowOrigins     []string `mapstructure:"allowOrigins"`
	AllowMethods     []string `mapstructure:"allowMethods"`
	AllowHeaders     []string `mapstructure:"allowHeaders"`
	ExposeHeaders    []string `mapstructure:"exposedHeaders"`
	MaxAge           int64    `mapstructure:"maxAge"`
	AllowCredentials bool     `mapstructure:"allowCredentials"`
}

func (Cors) AccessAllowHeaders

func (c Cors) AccessAllowHeaders() string

func (Cors) AccessAllowMethods

func (c Cors) AccessAllowMethods() string

func (Cors) AccessCredentials

func (c Cors) AccessCredentials() string

func (Cors) AccessExposedHeaders

func (c Cors) AccessExposedHeaders() string

func (Cors) AccessMaxAge

func (c Cors) AccessMaxAge() string

type FormDataDescribe

type FormDataDescribe struct {
	Values map[string][]string
	Files  map[string][]MultipartFile
}

func DescribeFormData

func DescribeFormData(form *multipart.Form) FormDataDescribe

type MultipartFile

type MultipartFile struct {
	Filename string
	Size     int64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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