Documentation ¶
Overview ¶
Package web provides abstraction to http web functionalies
Index ¶
Constants ¶
View Source
const ( // HTTPKeyRequestID contains key to HTTP Header requestID. HTTPKeyRequestID = "X-Request-ID" // HTTPKeyTraceID contains key to HTTP Header traceID. HTTPKeyTraceID = "X-Trace-ID" )
Variables ¶
View Source
var ( // ContextKeyRequestID to store/obtains requestID from context. ContextKeyRequestID = ContextKey("reqID") // ContextKeyHeader to store/obtains original http header from downstream. ContextKeyHeader = ContextKey("header") // ContextKeyTraceID to store/obtains traceID from downstream context. ContextKeyTraceID = ContextKey("traceID") // ContextKeyTranslator to store/obtains translator to/from request's context. ContextKeyTranslator = ContextKey("translator") )
Functions ¶
func GetIP ¶
GetIP returns the IP from given request. It will try to extract the real client IP from headers if possible.
func HeaderFromContext ¶
HeaderFromContext - get header value from context we set "header" key on context to set forwarded request context.
Types ¶
type ContextID ¶
type ContextID struct {
// contains filtered or unexported fields
}
ContextID is a struct which will be used as context key.
func ContextKey ¶
ContextKey constructs context key using name supplied.
type ErrorDetails ¶
type ErrorDetails struct { Exception string `json:"exception"` Errors []ErrorField `json:"errors"` }
ErrorDetails ...
type ErrorField ¶
ErrorField -.
type HTTPError ¶
type HTTPError struct { Code int `json:"code"` Message string `json:"message"` Response interface{} `json:"response"` }
HTTPError -.
func NewHTTPValidationError ¶
NewHTTPValidationError - return new HTTPError caused by validation error.
Directories ¶
Path | Synopsis |
---|---|
Package httpclient is *http.Client helpers
|
Package httpclient is *http.Client helpers |
Click to show internal directories.
Click to hide internal directories.