consts/header.go

40 lines
1.7 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Package consts ...
//
// Description : consts ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 2024-01-04 20:28
package consts
type HttpHeader string
func (hh *HttpHeader) String() string {
return string(*hh)
}
func (hh *HttpHeader) MarshalJSON() ([]byte, error) {
return []byte(hh.String()), nil
}
var (
HeaderKeyAccessControlAllowOrigin HttpHeader = "Access-Control-Allow-Origin" // 标识允许哪个域的请求
HeaderKeyAccessControlAllowHeaders HttpHeader = "Access-Control-Allow-Headers" // 标识允许的请求header
HeaderKeyAccessControlAllowMethods HttpHeader = "Access-Control-Allow-Methods" // 标识允许的请求方法
HeaderKeyAccessControlExposeHeaders HttpHeader = "Access-Control-Expose-Headers" // 允许浏览器端能够获取相应的header值
HeaderKeyAccessControlMaxAge HttpHeader = "Access-Control-Max-Age" // 控制发送预检请求options的频率单位 : 秒
)
var (
HeaderKeyContentType HttpHeader = "Content-Type" // 请求头中Content-Type的key
HeaderKeyReferer HttpHeader = "Referer" // 请求头中Referer的key
HeaderKeyUserAgent HttpHeader = "User-Agent" // 请求头中User-Agent的key
HeaderKeyAccept HttpHeader = "Accept" // accept
HeaderKeyAcceptEncoding HttpHeader = "Accept-Encoding" // accept-encoding
HeaderKeyAcceptLanguage HttpHeader = "Accept-Language" // accept-language
HeaderKeyAuthorization HttpHeader = "Authorization" // authorization
HeaderKeyCookie HttpHeader = "Cookie" // cookie
HeaderKeyOrigin HttpHeader = "Origin" // origin
HeaderKeyHost HttpHeader = "Host" // host
)