request

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2019 License: MIT Imports: 20 Imported by: 0

README

request

DEPRECATION NOTICE

This package is deprecated as of v2.x.x, please use r2 for future projects.

This package will be deleted in v3.x.x.

Documentation

Overview

Package request implements helpers for net/http.Client. It is designed to enable thorough testing of apps through mocked responses (which can be injected optionally). Deprecated: please use `go-sdk/r2` for future projects and migrate existing `go-sdk/request` projects as soon as possible.

Index

Constants

View Source
const (
	// ErrMultipleBodySources is an error returned if a request has both the post body and post data set.
	ErrMultipleBodySources = exception.Class("Cannot set both `Body` and `Post Data`")

	// ErrRequiresTransport is an error michael turner is going to hate.
	ErrRequiresTransport = exception.Class("Request settings require a http.Transport to be provided")
)
View Source
const (
	// DefaultKeepAlive returns if we should use a keep alive by default.
	DefaultKeepAlive = false
	// DefaultKeepAliveTimeout is the default time to keep idle connections open before they're closed.
	DefaultKeepAliveTimeout = 60 * time.Second
)
View Source
const (
	// MethodGet is a method.
	MethodGet = "GET"
	// MethodPost is a method.
	MethodPost = "POST"
	// MethodPut is a method.
	MethodPut = "PUT"
	// MethodPatch is a method.
	MethodPatch = "PATCH"
	// MethodDelete is a method.
	MethodDelete = "DELETE"
	// MethodOptions is a method.
	MethodOptions = "OPTIONS"
	// MethodList is a method.
	MethodList = "LIST"
)
View Source
const (
	// HeaderConnection is a http header.
	HeaderConnection = "Connection"
	// HeaderContentType is a http header.
	HeaderContentType = "Content-Type"
)
View Source
const (
	// ContentTypeApplicationJSON is a content type header value.
	ContentTypeApplicationJSON = "application/json; charset=utf-8"
	// ContentTypeApplicationXML is a content type header value.
	ContentTypeApplicationXML = "application/xml"
	// ContentTypeApplicationFormEncoded is a content type header value.
	ContentTypeApplicationFormEncoded = "application/x-www-form-urlencoded"
	// ContentTypeApplicationOctetStream is a content type header value.
	ContentTypeApplicationOctetStream = "application/octet-stream"
)
View Source
const (
	// Flag is a logger event flag.
	Flag logger.Flag = "request"
	// FlagResponse is a logger event flag.
	FlagResponse logger.Flag = "request.response"
)
View Source
const (
	// ConnectionKeepAlive is a connection header value.
	ConnectionKeepAlive = "keep-alive"
)

Variables

This section is empty.

Functions

func ClearMockedResponses

func ClearMockedResponses()

ClearMockedResponses clears any mocked responses that have been set up for the test.

func MockCatchAll

func MockCatchAll(generator MockedResponseGenerator)

MockCatchAll sets a "catch all" mock generator.

func MockResponse

func MockResponse(req *Request, generator MockedResponseGenerator)

MockResponse mocks are response with a given generator.

func MockResponseFromBinary

func MockResponseFromBinary(req *Request, statusCode int, responseBody []byte)

MockResponseFromBinary mocks a service request response from a set of binary responses.

func MockResponseFromFile

func MockResponseFromFile(verb string, url string, statusCode int, responseFilePath string)

MockResponseFromFile mocks a service request response from a set of file paths.

func MockResponseFromString

func MockResponseFromString(verb string, url string, statusCode int, responseBody string)

MockResponseFromString mocks a service request response from a string responseBody.

func NewRequestListener

func NewRequestListener(listener func(Event)) logger.Listener

NewRequestListener creates a new request listener.

Types

type CertInfo

type CertInfo struct {
	IssuerCommonName string    `json:"issuerCommonName" yaml:"issuerCommonName"`
	DNSNames         []string  `json:"dnsNames" yaml:"dnsNames"`
	NotAfter         time.Time `json:"notAfter" yaml:"notAfter"`
	NotBefore        time.Time `json:"notBefore" yaml:"notBefore"`
}

CertInfo is the information for a certificate.

func NewCertInfo

func NewCertInfo(res *http.Response) *CertInfo

NewCertInfo returns a new cert info from a response.

type Deserializer

type Deserializer func(body []byte) error

Deserializer is a function that does things with the response body.

type Event

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

Event is a logger event for outgoing requests.

func (Event) Flag

func (re Event) Flag() logger.Flag

Flag returns the event flag.

func (Event) Request

func (re Event) Request() *Meta

Request returns the request meta.

func (Event) Timestamp

func (re Event) Timestamp() time.Time

Timestamp returns the event timestamp.

func (Event) WriteJSON

func (re Event) WriteJSON() logger.JSONObj

WriteJSON implements logger.JSONWritable.

func (Event) WriteText

func (re Event) WriteText(tf logger.TextFormatter, buf *bytes.Buffer)

WriteText writes an outgoing request as text to a given buffer.

type Factory

type Factory struct {
	Log                    logger.Log
	MockedResponseProvider MockedResponseProvider
	OnRequest              Handler
	OnResponse             ResponseHandler
	Tracer                 Tracer
}

Factory is a helper to create requests with common metadata. It is generally for creating requests to *any* host.

func NewFactory

func NewFactory() *Factory

NewFactory creates a new Factory.

func (Factory) Create

func (m Factory) Create() *Request

Create creates a new request.

func (Factory) Get

func (m Factory) Get(url string) (*Request, error)

Get returns a new get request for a given url.

func (Factory) Post

func (m Factory) Post(url string, body []byte) (*Request, error)

Post returns a new post request for a given url.

func (*Factory) WithLogger

func (m *Factory) WithLogger(log logger.Log) *Factory

WithLogger sets the logger.

func (*Factory) WithMockedResponseProvider

func (m *Factory) WithMockedResponseProvider(mrp MockedResponseProvider) *Factory

WithMockedResponseProvider sets the mocked response provider.

func (*Factory) WithOnRequest

func (m *Factory) WithOnRequest(handler Handler) *Factory

WithOnRequest sets the on request handler..

func (*Factory) WithOnResponse

func (m *Factory) WithOnResponse(handler ResponseHandler) *Factory

WithOnResponse sets the on response handler.

func (*Factory) WithTracer

func (m *Factory) WithTracer(tracer Tracer) *Factory

WithTracer sets the tracer.

type HTTPTrace

type HTTPTrace struct {
	GetConn     time.Time `json:"getConn"`
	GotConn     time.Time `json:"gotConn"`
	PutIdleConn time.Time `json:"putIdleConn"`

	DNSStart time.Time `json:"dnsStart"`
	DNSDone  time.Time `json:"dnsDone"`

	ConnectStart time.Time `json:"connectStart"`
	ConnectDone  time.Time `json:"connectDone"`

	TLSHandshakeStart time.Time `json:"tlsHandshakeStart"`
	TLSHandshakeDone  time.Time `json:"tlsHandshakeDone"`

	WroteHeaders         time.Time `json:"wroteHeaders"`
	WroteRequest         time.Time `json:"wroteRequest"`
	GotFirstResponseByte time.Time `json:"gotFirstResponseByte"`

	DNSElapsed          time.Duration `json:"dnsElapsed"`
	TLSHandshakeElapsed time.Duration `json:"tlsHandshakeElapsed"`
	DialElapsed         time.Duration `json:"dialElapsed"`
	RequestElapsed      time.Duration `json:"requestElapsed"`
	ServerElapsed       time.Duration `json:"severElapsed"`
}

HTTPTrace is timing information for the full http call.

func (*HTTPTrace) Trace

func (ht *HTTPTrace) Trace() *httptrace.ClientTrace

Trace returns the trace binder.

type Handler

type Handler func(req *Request)

Handler is a receiver for `OnRequest`.

type Meta

type Meta struct {
	// StartTime will be 0 if the request has not been started yet
	StartTime time.Time
	Method    string
	URL       *url.URL
	Headers   http.Header
}

Meta is a summary of the request meta useful for logging.

func NewRequestMeta

func NewRequestMeta(req *http.Request) *Meta

NewRequestMeta returns a new meta object for a request.

type MockedResponse

type MockedResponse struct {
	Meta ResponseMeta
	Res  []byte
	Err  error
}

MockedResponse is the metadata and response body for a response

func MockedResponseInjector

func MockedResponseInjector(req *Request) *MockedResponse

MockedResponseInjector injects the mocked response into the request response.

func (MockedResponse) Response

func (mr MockedResponse) Response() *http.Response

Response returns a response object for the mock response.

type MockedResponseGenerator

type MockedResponseGenerator func(*Request) MockedResponse

MockedResponseGenerator is a function that returns a mocked response.

type MockedResponseProvider

type MockedResponseProvider func(*Request) *MockedResponse

MockedResponseProvider is a mocked response provider.

type PostedFile

type PostedFile struct {
	Key          string
	FileName     string
	FileContents io.Reader
}

PostedFile represents a file to post with the request.

type Request

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

Request makes http requests.

func Get

func Get(url string) *Request

Get returns a new get request.

func New

func New() *Request

New returns a new HTTPRequest instance.

func Post

func Post(url string, body []byte) *Request

Post returns a new post request with an optional body.

func (*Request) ApplyTransport

func (r *Request) ApplyTransport(transport *http.Transport) error

ApplyTransport applies the request settings to a transport.

func (*Request) AsDelete

func (r *Request) AsDelete() *Request

AsDelete sets the http verb of the request to `DELETE`.

func (*Request) AsGet

func (r *Request) AsGet() *Request

AsGet sets the http verb of the request to `GET`.

func (*Request) AsOptions

func (r *Request) AsOptions() *Request

AsOptions sets the http verb of the request to `OPTIONS`.

func (*Request) AsPatch

func (r *Request) AsPatch() *Request

AsPatch sets the http verb of the request to `PATCH`.

func (*Request) AsPost

func (r *Request) AsPost() *Request

AsPost sets the http verb of the request to `POST`.

func (*Request) AsPut

func (r *Request) AsPut() *Request

AsPut sets the http verb of the request to `PUT`.

func (*Request) BasicAuth

func (r *Request) BasicAuth() (username, password string)

BasicAuth returns the basic auth credentials for the request.

func (*Request) Bytes

func (r *Request) Bytes() ([]byte, error)

Bytes fetches the response as bytes.

func (*Request) BytesWithMeta

func (r *Request) BytesWithMeta() ([]byte, *ResponseMeta, error)

BytesWithMeta fetches the response as bytes with meta.

func (*Request) ClientTrace

func (r *Request) ClientTrace() *httptrace.ClientTrace

ClientTrace returns the diagnostics trace object.

func (*Request) ContentType

func (r *Request) ContentType() string

ContentType returns the request content type.

func (*Request) Context

func (r *Request) Context() context.Context

Context returns the request's context.

func (*Request) Deserialized

func (r *Request) Deserialized(deserialize Deserializer) (*ResponseMeta, error)

Deserialized runs a deserializer with the response.

func (*Request) DialTimeout

func (r *Request) DialTimeout() time.Duration

DialTimeout returns the request dial timeout.

func (*Request) DisableCompression

func (r *Request) DisableCompression() bool

DisableCompression returns if the requests transport should disable compression.

func (*Request) Discard

func (r *Request) Discard() error

Discard executes the request does not pass the response to handlers or events.

func (*Request) DiscardWithMeta

func (r *Request) DiscardWithMeta() (*ResponseMeta, error)

DiscardWithMeta discards the response but triggers listeners.

func (*Request) Equals

func (r *Request) Equals(other *Request) bool

Equals returns if a request equals another request.

func (*Request) Execute

func (r *Request) Execute() error

Execute makes the request and reads the response.

func (*Request) ExecuteWithMeta

func (r *Request) ExecuteWithMeta() (*ResponseMeta, error)

ExecuteWithMeta makes the request and returns the meta of the response.

func (*Request) GetPostData added in v1.0.0

func (r *Request) GetPostData(field string) string

GetPostData gets the first value set on the request via the WithPostData func associated with the given key. If there are no values associated with the key, GetPostData returns the empty string. This is a useful retrieval mechanism for mocks

func (*Request) Hash

func (r *Request) Hash() uint32

Hash returns a hashcode for a request.

func (*Request) Header

func (r *Request) Header() http.Header

Header returns the request headers.

func (*Request) Headers

func (r *Request) Headers() http.Header

Headers returns the headers on the request.

func (*Request) Host

func (r *Request) Host() string

Host returns the host.

func (*Request) JSON

func (r *Request) JSON(destination interface{}) error

JSON unmarshals the response as json to an object.

func (*Request) JSONError

func (r *Request) JSONError(errorObject interface{}) (*ResponseMeta, error)

JSONError unmarshals the response as json to an object if the meta indiciates an error.

func (*Request) JSONWithErrorHandler

func (r *Request) JSONWithErrorHandler(successObject interface{}, errorObject interface{}) (*ResponseMeta, error)

JSONWithErrorHandler unmarshals the response as json to an object with metadata or an error object depending on the meta.

func (*Request) JSONWithMeta

func (r *Request) JSONWithMeta(destination interface{}) (*ResponseMeta, error)

JSONWithMeta unmarshals the response as json to an object with metadata.

func (*Request) KeepAlive

func (r *Request) KeepAlive() bool

KeepAlive returns if the keep alive.

func (*Request) KeepAliveTimeout

func (r *Request) KeepAliveTimeout() time.Duration

KeepAliveTimeout returns the keep alive timeout, ro the time before idle connections are closed.

func (*Request) Logger

func (r *Request) Logger() logger.Log

Logger returns the request diagnostics agent.

func (*Request) Meta

func (r *Request) Meta() *Meta

Meta returns the request as a HTTPRequestMeta.

func (*Request) Method

func (r *Request) Method() string

Method returns the request method.

func (*Request) MockProvider

func (r *Request) MockProvider() MockedResponseProvider

MockProvider returns the request mock provider.

func (*Request) MustWithRawURL

func (r *Request) MustWithRawURL(rawURL string) *Request

MustWithRawURL sets the request target url whole hog.

func (*Request) MustWithRawURLf

func (r *Request) MustWithRawURLf(format string, args ...interface{}) *Request

MustWithRawURLf sets the url based on a format and args.

func (*Request) Path

func (r *Request) Path() string

Path returns the request path.

func (*Request) PostBody

func (r *Request) PostBody() (io.Reader, error)

PostBody returns the current post body.

func (*Request) Request

func (r *Request) Request() (*http.Request, error)

Request returns a http.Request for the HTTPRequest.

func (*Request) RequestHandler

func (r *Request) RequestHandler() Handler

RequestHandler returns the request handler.

func (*Request) RequiresTransport

func (r *Request) RequiresTransport() bool

RequiresTransport returns if there are request settings that require a shared transport.

func (*Request) Response

func (r *Request) Response() (res *http.Response, err error)

Response makes the actual request but returns the underlying http.Response object.

func (*Request) ResponseHandler

func (r *Request) ResponseHandler() ResponseHandler

ResponseHandler returns the request response handler.

func (*Request) ResponseHeaderTimeout

func (r *Request) ResponseHeaderTimeout() time.Duration

ResponseHeaderTimeout returns a timeout.

func (*Request) Scheme

func (r *Request) Scheme() string

Scheme returns the request url scheme.

func (*Request) State

func (r *Request) State() interface{}

State returns the request state.

func (*Request) String

func (r *Request) String() (string, error)

String returns the body of the response as a string.

func (*Request) StringWithMeta

func (r *Request) StringWithMeta() (string, *ResponseMeta, error)

StringWithMeta returns the body of the response as a string in addition to the response metadata.

func (*Request) TLSHandshakeTimeout

func (r *Request) TLSHandshakeTimeout() time.Duration

TLSHandshakeTimeout returns a timeout.

func (*Request) TLSSkipVerify

func (r *Request) TLSSkipVerify() bool

TLSSkipVerify returns if we should skip server tls verification.

func (*Request) Timeout

func (r *Request) Timeout() time.Duration

Timeout returns the request timeout.

func (*Request) Tracer

func (r *Request) Tracer() Tracer

Tracer returns the request tracer.

func (*Request) Transport

func (r *Request) Transport() *http.Transport

Transport returns a shared http transport.

func (*Request) URL

func (r *Request) URL() *url.URL

URL returns the request target url.

func (*Request) WithBasicAuth

func (r *Request) WithBasicAuth(username, password string) *Request

WithBasicAuth sets the basic auth headers for a request.

func (*Request) WithClientTrace

func (r *Request) WithClientTrace(trace *httptrace.ClientTrace) *Request

WithClientTrace sets up a trace for the request.

func (*Request) WithContentType

func (r *Request) WithContentType(contentType string) *Request

WithContentType sets the `Content-Type` header for the request.

func (*Request) WithContext

func (r *Request) WithContext(ctx context.Context) *Request

WithContext sets a context for the request.

func (*Request) WithCookie

func (r *Request) WithCookie(cookie *http.Cookie) *Request

WithCookie sets a cookie for the request.

func (*Request) WithDialTimeout

func (r *Request) WithDialTimeout(timeout time.Duration) *Request

WithDialTimeout sets a dial timeout for the request.

func (*Request) WithDisableCompression

func (r *Request) WithDisableCompression(value bool) *Request

WithDisableCompression sets the disable compression value.

func (*Request) WithHeader

func (r *Request) WithHeader(field string, value string) *Request

WithHeader sets a header on the request.

func (*Request) WithHeaders

func (r *Request) WithHeaders(headers http.Header) *Request

WithHeaders adds a set of headers to the request.

func (*Request) WithHost

func (r *Request) WithHost(host string) *Request

WithHost sets the target url host for the request.

func (*Request) WithKeepAlive

func (r *Request) WithKeepAlive() *Request

WithKeepAlive sets if the request should use the `Connection=keep-alive` header or not.

func (*Request) WithKeepAliveTimeout

func (r *Request) WithKeepAliveTimeout(timeout time.Duration) *Request

WithKeepAliveTimeout sets a keep alive timeout for the requests transport.

func (*Request) WithLogger

func (r *Request) WithLogger(log logger.Log) *Request

WithLogger enables logging with HTTPRequestLogLevelErrors.

func (*Request) WithMethod

func (r *Request) WithMethod(verb string) *Request

WithMethod sets the http verb/method of the request.

func (*Request) WithMockProvider

func (r *Request) WithMockProvider(provider MockedResponseProvider) *Request

WithMockProvider mocks a request response.

func (*Request) WithPath

func (r *Request) WithPath(path string) *Request

WithPath sets the path component of the host url..

func (*Request) WithPathf

func (r *Request) WithPathf(format string, args ...interface{}) *Request

WithPathf sets the path component of the host url by the format and arguments.

func (*Request) WithPostBody

func (r *Request) WithPostBody(body []byte) *Request

WithPostBody sets the post body directly.

func (*Request) WithPostBodyAsJSON

func (r *Request) WithPostBodyAsJSON(object interface{}) *Request

WithPostBodyAsJSON sets the post body raw to be the json representation of an object.

func (*Request) WithPostBodyAsXML

func (r *Request) WithPostBodyAsXML(object interface{}) *Request

WithPostBodyAsXML sets the post body raw to be the xml representation of an object.

func (*Request) WithPostBodySerialized

func (r *Request) WithPostBodySerialized(object interface{}, serialize Serializer) *Request

WithPostBodySerialized sets the post body with the results of the given serializer.

func (*Request) WithPostData

func (r *Request) WithPostData(field string, value string) *Request

WithPostData sets a post data value for the request.

func (*Request) WithPostedFile

func (r *Request) WithPostedFile(key, fileName string, fileContents io.Reader) *Request

WithPostedFile adds a posted file to the multipart form elements of the request.

func (*Request) WithQueryString

func (r *Request) WithQueryString(field string, value string) *Request

WithQueryString sets a query string value for the host url of the request.

func (*Request) WithRawURL

func (r *Request) WithRawURL(rawURL string) (*Request, error)

WithRawURL sets the request target url whole hog.

func (*Request) WithRawURLf

func (r *Request) WithRawURLf(format string, args ...interface{}) (*Request, error)

WithRawURLf sets the url based on a format and args.

func (*Request) WithRequestHandler

func (r *Request) WithRequestHandler(handler Handler) *Request

WithRequestHandler configures an event receiver.

func (*Request) WithResponseHandler

func (r *Request) WithResponseHandler(listener ResponseHandler) *Request

WithResponseHandler configures an event receiver.

func (*Request) WithResponseHeaderTimeout

func (r *Request) WithResponseHeaderTimeout(timeout time.Duration) *Request

WithResponseHeaderTimeout sets a timeout

func (*Request) WithScheme

func (r *Request) WithScheme(scheme string) *Request

WithScheme sets the scheme, or protocol, of the request.

func (*Request) WithState

func (r *Request) WithState(state interface{}) *Request

WithState adds a state object to the request for later usage.

func (*Request) WithTLSClientCert

func (r *Request) WithTLSClientCert(cert []byte) *Request

WithTLSClientCert sets a tls cert on the transport for the request.

func (*Request) WithTLSClientCertPair added in v1.0.0

func (r *Request) WithTLSClientCertPair(cert, key []byte) *Request

WithTLSClientCertPair sets a tls cert on the transport for the request.

func (*Request) WithTLSClientKey

func (r *Request) WithTLSClientKey(key []byte) *Request

WithTLSClientKey sets a tls key on the transport for the request.

func (*Request) WithTLSHandshakeTimeout

func (r *Request) WithTLSHandshakeTimeout(timeout time.Duration) *Request

WithTLSHandshakeTimeout sets a timeout

func (*Request) WithTLSRootCAPool

func (r *Request) WithTLSRootCAPool(certPool *x509.CertPool) *Request

WithTLSRootCAPool sets the root TLS ca pool for the request.

func (*Request) WithTLSSkipVerify

func (r *Request) WithTLSSkipVerify(skipVerify bool) *Request

WithTLSSkipVerify skips the bad certificate checking on TLS requests.

func (*Request) WithTimeout

func (r *Request) WithTimeout(timeout time.Duration) *Request

WithTimeout sets a timeout for the request. This timeout enforces the time between the start of the connection dial to the first response byte.

func (*Request) WithTracer

func (r *Request) WithTracer(tracer Tracer) *Request

WithTracer sets the request tracer.

func (*Request) WithTransport

func (r *Request) WithTransport(transport *http.Transport) *Request

WithTransport sets a transport for the request.

func (*Request) WithURL

func (r *Request) WithURL(target *url.URL) *Request

WithURL sets the request url target.

func (*Request) XML

func (r *Request) XML(destination interface{}) error

XML unmarshals the response as xml to an object with metadata.

func (*Request) XMLWithErrorHandler

func (r *Request) XMLWithErrorHandler(successObject interface{}, errorObject interface{}) (*ResponseMeta, error)

XMLWithErrorHandler unmarshals the response as xml to an object with metadata or an error object depending on the meta.

func (*Request) XMLWithMeta

func (r *Request) XMLWithMeta(destination interface{}) (*ResponseMeta, error)

XMLWithMeta unmarshals the response as xml to an object with metadata.

type ResponseEvent

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

ResponseEvent is a response to outgoing requests.

func (ResponseEvent) Body

func (re ResponseEvent) Body() []byte

Body returns the outgoing request body.

func (ResponseEvent) Flag

func (re ResponseEvent) Flag() logger.Flag

Flag returns the event flag.

func (ResponseEvent) Request

func (re ResponseEvent) Request() *Meta

Request returns the request meta.

func (ResponseEvent) Response

func (re ResponseEvent) Response() *ResponseMeta

Response returns the response meta.

func (ResponseEvent) Timestamp

func (re ResponseEvent) Timestamp() time.Time

Timestamp returns the event timestamp.

func (ResponseEvent) WriteJSON

func (re ResponseEvent) WriteJSON() logger.JSONObj

WriteJSON implements logger.JSONWritable.

func (ResponseEvent) WriteText

func (re ResponseEvent) WriteText(tf logger.TextFormatter, buf *bytes.Buffer)

WriteText writes the event to a text writer.

type ResponseHandler

type ResponseHandler func(req *Request, res *ResponseMeta, content []byte)

ResponseHandler is a receiver for `OnResponse`.

type ResponseMeta

type ResponseMeta struct {
	Cert            *CertInfo
	CompleteTime    time.Time
	StatusCode      int
	ContentLength   int64
	ContentEncoding string
	ContentType     string
	Headers         http.Header
}

ResponseMeta is just the meta information for an http response.

func NewResponseMeta

func NewResponseMeta(res *http.Response) *ResponseMeta

NewResponseMeta returns a new meta object for a response.

type Serializer

type Serializer func(value interface{}) ([]byte, error)

Serializer is a function that turns an object into raw data.

type TraceFinisher

type TraceFinisher interface {
	Finish(*http.Request, *ResponseMeta, error)
}

TraceFinisher is a finisher for traces.

type Tracer

type Tracer interface {
	Start(*http.Request) TraceFinisher
}

Tracer is a tracer for requests.

Directories

Path Synopsis
_examples
mtls command
request command
transport command

Jump to

Keyboard shortcuts

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