wrapper

package
v6.36.2+incompatible Latest Latest
Warning

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

Go to latest
Published: May 16, 2018 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RequestLogger

type RequestLogger struct {
	// contains filtered or unexported fields
}

RequestLogger is the wrapper that logs requests to and responses from a plugin repository

func NewRequestLogger

func NewRequestLogger(output RequestLoggerOutput) *RequestLogger

NewRequestLogger returns a pointer to a RequestLogger wrapper

func (*RequestLogger) Make

func (logger *RequestLogger) Make(request *http.Request, passedResponse *plugin.Response, proxyReader plugin.ProxyReader) error

Make records the request and the response to UI

func (*RequestLogger) Wrap

func (logger *RequestLogger) Wrap(innerconnection plugin.Connection) plugin.Connection

Wrap sets the connection on the RequestLogger and returns itself

type RequestLoggerOutput

type RequestLoggerOutput interface {
	DisplayDump(dump string) error
	DisplayHeader(name string, value string) error
	DisplayHost(name string) error
	DisplayJSONBody(body []byte) error
	DisplayRequestHeader(method string, uri string, httpProtocol string) error
	DisplayResponseHeader(httpProtocol string, status string) error
	DisplayType(name string, requestDate time.Time) error
	HandleInternalError(err error)
	Start() error
	Stop() error
}

RequestLoggerOutput is the interface for displaying logs

type RetryRequest

type RetryRequest struct {
	// contains filtered or unexported fields
}

RetryRequest is a wrapper that retries failed requests if they contain a 5XX status code.

func NewRetryRequest

func NewRetryRequest(maxRetries int) *RetryRequest

NewRetryRequest returns a pointer to a RetryRequest wrapper.

func (*RetryRequest) Make

func (retry *RetryRequest) Make(request *http.Request, passedResponse *plugin.Response, proxyReader plugin.ProxyReader) error

Make retries the request if it comes back with a 5XX status code.

func (*RetryRequest) Wrap

func (retry *RetryRequest) Wrap(innerconnection plugin.Connection) plugin.Connection

Wrap sets the connection in the RetryRequest and returns itself.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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