httptools

package
v0.9.16 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenName         = "Token" // the name "Token" be used many places, so use the name "TokenName"
	TokenGame         = "TokenGame"
	Authorization     = "Authorization"
	AuthorizationGame = "AuthorizationGame"
)

Variables

This section is empty.

Functions

func ApiWithBaseUrl

func ApiWithBaseUrl(preUrl, url string) string

func GenerateToken

func GenerateToken(username string) (string, error)

func GetToken

func GetToken(r *http.Request) string

func GetTokenByHeader

func GetTokenByHeader(header http.Header) string

func GetTokenGame

func GetTokenGame(r *http.Request) string

func GetTokenGameByHeader

func GetTokenGameByHeader(header http.Header) string

func HttpErrorResponse

func HttpErrorResponse(w http.ResponseWriter, message string, code int)

func HttpOkResponse

func HttpOkResponse[T any](w http.ResponseWriter, res T)

func ValidToken

func ValidToken(tokenString string) error

Types

type ReqBase

type ReqBase struct {
	Ts int64 `json:"ts"`
}

type ResBase

type ResBase struct {
	ErrorIdd int    `json:"errorId"`
	Message  string `json:"message"`
	Ts       int64  `json:"ts"`
}

Jump to

Keyboard shortcuts

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