aurestrecorder

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const RecorderPathEnvVariable = "GO_AUTUMN_RESTCLIENT_RECORDER_PATH"

Variables

This section is empty.

Functions

func ConstructFilename

func ConstructFilename(method string, requestUrl string) (string, error)

func ConstructFilenameV2 added in v0.4.1

func ConstructFilenameV2(method string, requestUrl string) (string, error)

func ConstructFilenameV3 added in v0.4.3

func ConstructFilenameV3(method string, requestUrl string) (string, error)

func New

New builds a new http recorder.

Insert this into your stack just above the actual http client.

Normally it does nothing, but if you set the environment variable RecorderPathEnvVariable to a path to a directory, it will write response recordings for your requests that you can then play back using aurestplayback.PlaybackImpl in your tests.

Types

type RecorderData

type RecorderData struct {
	Method         string                         `json:"method"`
	RequestUrl     string                         `json:"requestUrl"`
	RequestBody    interface{}                    `json:"requestBody,omitempty"`
	ParsedResponse aurestclientapi.ParsedResponse `json:"parsedResponse"`
	Error          error                          `json:"error,omitempty"`
}

type RecorderImpl

type RecorderImpl struct {
	Wrapped      aurestclientapi.Client
	RecorderPath string
}

func (*RecorderImpl) Perform

func (c *RecorderImpl) Perform(ctx context.Context, method string, requestUrl string, requestBody interface{}, response *aurestclientapi.ParsedResponse) error

Jump to

Keyboard shortcuts

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