Documentation ¶
Overview ¶
Code generated by mockery v1.0.0. DO NOT EDIT.
Index ¶
- Constants
- Variables
- func Capture(logger kitlog.Logger) kithttp.RequestFunc
- func ErrorLogEncoder(logger kitlog.Logger, ee kithttp.ErrorEncoder) kithttp.ErrorEncoder
- func ForwardHeadersByPrefix(p string, from http.Header, to http.Header)
- func TransactionLogging(logger kitlog.Logger) kithttp.ServerFinalizerFunc
- func Welcome(delegate http.Handler) http.Handler
- type CodedError
- type MockTr1d1umTransactor
- type Tr1d1umTransactor
- type Tr1d1umTransactorOptions
- type XmidtResponse
Constants ¶
const ( ContextKeyRequestArrivalTime contextKey = iota ContextKeyRequestTID ContextKeyTransactionInfoLogger )
Keys to important context values on incoming requests to TR1D1UM
const HeaderWPATID = "X-WebPA-Transaction-Id"
HeaderWPATID is the header key for the WebPA transaction UUID
Variables ¶
var ErrTr1d1umInternal = errors.New("oops! Something unexpected went wrong in this service")
ErrTr1d1umInternal should be the error shown to external API consumers in Internal Server error cases
Functions ¶
func Capture ¶
func Capture(logger kitlog.Logger) kithttp.RequestFunc
Capture (for lack of a better name) captures context values of interest from the incoming request. Unlike Welcome, values captured here are intended to be used only throughout the gokit server flow: (request decoding, business logic, response encoding)
func ErrorLogEncoder ¶
func ErrorLogEncoder(logger kitlog.Logger, ee kithttp.ErrorEncoder) kithttp.ErrorEncoder
ErrorLogEncoder decorates the errorEncoder in such a way that errors are logged with their corresponding unique request identifier
func ForwardHeadersByPrefix ¶
ForwardHeadersByPrefix copies headers h where the source and target are 'from' and 'to' respectively such that key(h) has p as prefix
func TransactionLogging ¶
func TransactionLogging(logger kitlog.Logger) kithttp.ServerFinalizerFunc
TransactionLogging is used by the different Tr1d1um services to keep track of incoming requests and their corresponding responses
Types ¶
type CodedError ¶
CodedError describes the behavior of an error that additionally has an HTTP status code used for TR1D1UM business logic
func NewBadRequestError ¶
func NewBadRequestError(e error) CodedError
NewBadRequestError is the constructor for an error returned for bad HTTP requests to tr1d1um
func NewCodedError ¶
func NewCodedError(e error, code int) CodedError
NewCodedError upgrades an Error to a CodedError e must not be non-nil to avoid panics
type MockTr1d1umTransactor ¶
MockTr1d1umTransactor is an autogenerated mock type for the Tr1d1umTransactor type
func (*MockTr1d1umTransactor) Transact ¶
func (_m *MockTr1d1umTransactor) Transact(_a0 *http.Request) (*XmidtResponse, error)
Transact provides a mock function with given fields: _a0
type Tr1d1umTransactor ¶
type Tr1d1umTransactor interface {
Transact(*http.Request) (*XmidtResponse, error)
}
Tr1d1umTransactor performs a typical HTTP request but enforces some logic onto the HTTP transaction such as context-based timeout and header filtering this is a common utility for the stat and config tr1d1um services
func NewTr1d1umTransactor ¶
func NewTr1d1umTransactor(o *Tr1d1umTransactorOptions) Tr1d1umTransactor
type Tr1d1umTransactorOptions ¶
type Tr1d1umTransactorOptions struct { //RequestTimeout is the deadline duration for the HTTP transaction to be completed RequestTimeout time.Duration //Do is the core responsible to perform the actual HTTP request Do func(*http.Request) (*http.Response, error) }
Tr1d1umTransactorOptions include parameters needed to configure the transactor
type XmidtResponse ¶
type XmidtResponse struct { //Code is the HTTP Status code received from the transaction Code int //ForwardedHeaders contains all the headers tr1d1um keeps from the transaction ForwardedHeaders http.Header //Body represents the full data off the XMiDT http.Response body Body []byte }
XmidtResponse represents the data that a tr1d1um transactor keeps from an HTTP request to the XMiDT API