request

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const RequestIDHeader = "X-Request-Id"

RequestIDHeader is the name of the header we use to return request IDs for debugging

Variables

View Source
var HeaderSDKVersion = "X-Usercloudssdk-Version"

HeaderSDKVersion is the header name for the UserClouds SDK version

Functions

func GetAuthHeader added in v0.6.5

func GetAuthHeader(ctx context.Context) string

GetAuthHeader returns the Authorization Header for this particular request

func GetForwardedFor added in v0.8.5

func GetForwardedFor(ctx context.Context) string

GetForwardedFor returns the X-Forwarded-For header for this particular request

func GetHostname

func GetHostname(ctx context.Context) string

GetHostname returns the hostname used for this particular request

func GetRemoteIP added in v0.8.5

func GetRemoteIP(ctx context.Context) string

GetRemoteIP returns the remote IP for this particular request

func GetRequestDataMap added in v0.8.0

func GetRequestDataMap(ctx context.Context) map[string]string

GetRequestDataMap returns the a map of request data for a particular request, this is useful when we want to pass unstructured data to to other systems (sentry, tracing, etc...) and we don't have a reference to the request object

func GetRequestID

func GetRequestID(ctx context.Context) uuid.UUID

GetRequestID returns a per request id if one was set

func GetRequestIDFromHeader

func GetRequestIDFromHeader(header http.Header) string

GetRequestIDFromHeader returns the request ID a response headers if present, otherwise, returns an empty string

func GetSDKVersion added in v0.8.5

func GetSDKVersion(ctx context.Context) string

GetSDKVersion returns the UserClouds SDK version (from header) for this particular request

func GetUserAgent added in v0.8.3

func GetUserAgent(ctx context.Context) string

GetUserAgent returns the User-Agent header for this particular request

func NewRequestID added in v1.0.0

func NewRequestID(ctx context.Context) context.Context

NewRequestID sets a per request id if one was not set

func SetRequestData added in v0.8.0

func SetRequestData(ctx context.Context, req *http.Request, requestID uuid.UUID) context.Context

SetRequestData sets capture a bunch of data from the request and saves into a struct in the context

func SetRequestIDIfNotSet added in v0.6.6

func SetRequestIDIfNotSet(ctx context.Context, requestID uuid.UUID) context.Context

SetRequestIDIfNotSet sets a per request id if one was not set - for use for non-HTTP request flow (go routines, worker tasks, etc...)

Types

This section is empty.

Jump to

Keyboard shortcuts

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