Documentation ¶
Index ¶
- func DescribeJson(reader io.Reader) (map[string]any, error)
- func DescribeRawJson(reader io.Reader) ([]byte, error)
- func GetAcceptLanguage(ctx *gin.Context) []string
- func GetBearerToken(authHeader string) string
- func GetBearerTokenFromCtx(ctx *gin.Context) string
- func GetFirstAcceptLanguage(ctx *gin.Context) string
- func GetQualityValuePairs(header string) []string
- func GetRequestContentType(ctx *gin.Context) string
- func GetRequestId(ctx *gin.Context) (requestId string)
- func GetResponseContentType(ctx *gin.Context) string
- func SetRequestId(ctx *gin.Context, id string)
- type Cors
- type FormDataDescribe
- type MultipartFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAcceptLanguage ¶
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 GetBearerTokenFromCtx ¶
GetBearerTokenFromCtx get bearer token from Authorization Header param ctx *gin.Context return string
func GetFirstAcceptLanguage ¶
func GetQualityValuePairs ¶
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 GetRequestId ¶
func GetResponseContentType ¶
func SetRequestId ¶
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 (Cors) AccessAllowMethods ¶
func (Cors) AccessCredentials ¶
func (Cors) AccessExposedHeaders ¶
func (Cors) AccessMaxAge ¶
type FormDataDescribe ¶
type FormDataDescribe struct { Values map[string][]string Files map[string][]MultipartFile }
func DescribeFormData ¶
func DescribeFormData(form *multipart.Form) FormDataDescribe
type MultipartFile ¶
Click to show internal directories.
Click to hide internal directories.