requests

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HttpString = func(httpCode int) string {
		return fmt.Sprintf("%d: %s", httpCode, http.StatusText(httpCode))
	}
)

Functions

func ClientId

func ClientId(ctx context.Context) string

ClientId get client id from context

func ClientIdEcho added in v0.3.0

func ClientIdEcho(ec echo.Context) string

ClientIdEcho get client id from echo context

func GenerateUUIDV4

func GenerateUUIDV4() string

GenerateUUIDV4 produce UUIDv4 string value

func Id

func Id(ctx context.Context) string

Id get request id from context

func IdEcho added in v0.3.0

func IdEcho(ec echo.Context) string

IdEcho get request id from echo context

func IdEchoUid added in v0.3.0

func IdEchoUid(ec echo.Context) string

IdEchoUid get request id from echo context and convert into uuid

func IdEchoUidWithSuffix added in v0.3.0

func IdEchoUidWithSuffix(ec echo.Context, suffix string) string

IdEchoUidWithSuffix get request id from echo context, convert into uuid and add suffix

func IdEchoWithSuffix added in v0.3.0

func IdEchoWithSuffix(ec echo.Context, suffix string) string

IdEchoWithSuffix get request id from echo context and add suffix

func IdUid added in v0.3.0

func IdUid(ctx context.Context) string

IdUid get request id from context and convert it into uuid

func IdUidWithSuffix added in v0.3.0

func IdUidWithSuffix(ctx context.Context, suffix string) string

IdUidWithSuffix get request id from context, convert it into uuid and add suffix

func IsHttp1xx

func IsHttp1xx(httpCode int) bool

IsHttp1xx check http code is between 100 and 200

func IsHttp2xx

func IsHttp2xx(httpCode int) bool

IsHttp2xx check http code is between 200 and 300

func IsHttp3xx

func IsHttp3xx(httpCode int) bool

IsHttp3xx check http code is between 300 and 400

func IsHttp4xx

func IsHttp4xx(httpCode int) bool

IsHttp4xx check http code is between 400 and 500

func IsHttp5xx

func IsHttp5xx(httpCode int) bool

IsHttp5xx check http code is above inclusive 500

func IsHttpError

func IsHttpError(httpCode int) bool

IsHttpError treat error when http code above inclusive 300

Types

type Header string
const (
	HeaderAuthorization       Header = "Authorization"
	HeaderAuthorizationBearer Header = "Bearer"

	HeaderApiKey         Header = "X-API-KEY"
	HeaderClientId       Header = "X-CLIENT-ID"
	HeaderSignature      Header = "X-SIGNATURE"
	HeaderIdempotencyKey Header = "X-IDEMPOTENCY-KEY"
)

func (Header) String added in v0.3.6

func (h Header) String() string

type RequestContext

type RequestContext string
const (
	ContextClientId  RequestContext = "client_id"
	ContextRequestId RequestContext = "request_id"
	ContextSignature RequestContext = "signature"
)

func (RequestContext) String

func (t RequestContext) String() string

Jump to

Keyboard shortcuts

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