khttpclient

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTime

func IsTime(stringDate string) bool

IsTime checks whether the given string is of time format

func MockRespFromYaml

func MockRespFromYaml(kctx *internal.Context, logger *zap.Logger, req *http.Request, reqBody []byte, meta map[string]string) (*http.Response, error, bool)

Types

type Interceptor

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

func NewInterceptor

func NewInterceptor(core http.RoundTripper) *Interceptor

NewInterceptor constructs and returns the pointer to Interceptor. Interceptor is used to intercept every http client calls and store their responses into keploy context. The default mode of the pkg keploy context of the interceptor returned here is MODE_OFF.

func (Interceptor) RoundTrip

func (i Interceptor) RoundTrip(r *http.Request) (*http.Response, error)

RoundTrip is the custom method which is called before making http client calls to capture or replay the outputs of external http service.

func (*Interceptor) SetContext

func (i *Interceptor) SetContext(requestContext context.Context)

SetContext is used to store the keploy context from request context into the Interceptor kctx field.

type ReadCloser

type ReadCloser struct {
	*bytes.Reader
	Body io.ReadCloser
}

ReadCloser is used so that gob could encode-decode http.Response.

func (ReadCloser) Close

func (rc ReadCloser) Close() error

func (*ReadCloser) MarshalBinary

func (rc *ReadCloser) MarshalBinary() ([]byte, error)

func (*ReadCloser) UnmarshalBinary

func (rc *ReadCloser) UnmarshalBinary(b []byte) error

Jump to

Keyboard shortcuts

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