headerx

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 客户端侧
	XAppIdHeader = "x-app-id"

	// 服务端侧
	XHttpCode            = "x-http-code"
	XForwardedForHeader  = "x-forwarded-for"
	XForwardedHostHeader = "x-forwarded-host"
)
View Source
const AuthoneTokenKey = "authone_token"
View Source
const SessionDuration = 2 * time.Hour
View Source
const SessionKey = "_session"

Variables

This section is empty.

Functions

func ClearSessionId

func ClearSessionId(ctx context.Context, sessionId string, domain string)

ClearSessionId 清除sessionId

func GetAppId

func GetAppId(ctx context.Context) string

GetAppId 获取应用Id

func GetDomain

func GetDomain(ctx context.Context) string

GetDomain 获取域名

func GetDomainIdentifier

func GetDomainIdentifier(ctx context.Context) string

GetDomainIdentifier 获取域名标识

func GetHeader

func GetHeader(ctx context.Context, key string) string

GetHeader 获取header

func GetHttpHeader

func GetHttpHeader(ctx context.Context, key string) string

GetHttpHeader 获取http header

func GetSessionId

func GetSessionId(ctx context.Context) string

GetSessionId 获取sessionId

func ReadCookies

func ReadCookies(ctx context.Context, filter string) []*http.Cookie

ReadCookies parses all "Cookie" values from the header h and returns the successfully parsed Cookies.

if filter isn't empty, only cookies of that name are returned

func SetCookie

func SetCookie(ctx context.Context, cookies []*http.Cookie)

SetCookie 设置cookie

func SetHeader

func SetHeader(ctx context.Context, key string, value string)

SetHeader 设置header

func SetHttpCode

func SetHttpCode(ctx context.Context, code string)

SetHttpCode 设置http code

func SetHttpHeader

func SetHttpHeader(ctx context.Context, key string, value string)

SetHttpHeader 设置http header, key为http header的key,如SetCookie

func SetSessionId

func SetSessionId(ctx context.Context, sessionId string, domain string)

SetSessionId 设置sessionId

Types

This section is empty.

Jump to

Keyboard shortcuts

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