khttpclient

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: Apache-2.0 Imports: 23 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTime added in v0.7.6

func IsTime(stringDate string) bool

IsTime checks whether the given string is of time format

func MockRespFromYaml added in v0.7.6

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

Types

type Interceptor added in v0.3.5

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

func NewInterceptor added in v0.3.5

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 added in v0.3.5

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 added in v0.3.5

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