Documentation ¶
Index ¶
- Constants
- func GetRequestLogFields(request *models.RequestDetails) *log.Fields
- func GetResponseLogFields(response *models.ResponseDetails) *log.Fields
- func ReconstructRequest(pair models.RequestResponsePair) (*http.Request, error)
- func ReconstructResponse(request *http.Request, pair models.RequestResponsePair) *http.Response
- type CaptureMode
- type DiffMode
- func (this *DiffMode) JsonDiff(prefix string, expected map[string]interface{}, actual map[string]interface{}) bool
- func (this *DiffMode) Process(request *http.Request, details models.RequestDetails) (ProcessResult, error)
- func (this *DiffMode) SetArguments(arguments ModeArguments)
- func (this *DiffMode) View() v2.ModeView
- type HoverflyCapture
- type HoverflyDiff
- type HoverflyModify
- type HoverflySimulate
- type HoverflySpy
- type HoverflySynthesize
- type Mode
- type ModeArguments
- type ModifyMode
- type PostServeActionInputDetails
- type ProcessResult
- type SimulateMode
- type SpyMode
- type SynthesizeMode
Constants ¶
const Capture = "capture"
CaptureMode - requests are captured and stored in cache
const Diff = "diff"
DiffMode - calls real service and compares response with simulation
const Modify = "modify"
ModifyMode - middleware is applied to outgoing and incoming traffic
const Simulate = "simulate"
SimulateMode - default mode when Hoverfly looks for captured requests to respond
const Spy = "spy"
SpyMode - simulateMode but will call real service when cache miss
const Synthesize = "synthesize"
SynthesizeMode - all requests are sent to middleware to create response
Variables ¶
This section is empty.
Functions ¶
func GetRequestLogFields ¶
func GetRequestLogFields(request *models.RequestDetails) *log.Fields
func GetResponseLogFields ¶
func GetResponseLogFields(response *models.ResponseDetails) *log.Fields
func ReconstructRequest ¶
func ReconstructRequest(pair models.RequestResponsePair) (*http.Request, error)
ReconstructRequest replaces original request with details provided in Constructor Payload.RequestMatcher
func ReconstructResponse ¶
ReconstructResponse changes original response with details provided in Constructor Payload.Response
Types ¶
type CaptureMode ¶
type CaptureMode struct { Hoverfly HoverflyCapture Arguments ModeArguments }
func (*CaptureMode) GetArguments ¶ added in v0.12.0
func (this *CaptureMode) GetArguments(arguments ModeArguments)
func (CaptureMode) Process ¶
func (this CaptureMode) Process(request *http.Request, details models.RequestDetails) (ProcessResult, error)
func (*CaptureMode) SetArguments ¶ added in v0.11.0
func (this *CaptureMode) SetArguments(arguments ModeArguments)
func (*CaptureMode) View ¶ added in v0.12.0
func (this *CaptureMode) View() v2.ModeView
type DiffMode ¶ added in v0.16.0
type DiffMode struct { Hoverfly HoverflyDiff DiffReport v2.DiffReport Arguments ModeArguments }
func (*DiffMode) Process ¶ added in v0.16.0
func (this *DiffMode) Process(request *http.Request, details models.RequestDetails) (ProcessResult, error)
TODO: We should only need one of these two parameters
func (*DiffMode) SetArguments ¶ added in v0.16.0
func (this *DiffMode) SetArguments(arguments ModeArguments)
type HoverflyCapture ¶
type HoverflyCapture interface { ApplyMiddleware(models.RequestResponsePair) (models.RequestResponsePair, error) DoRequest(*http.Request) (*http.Response, error) Save(*models.RequestDetails, *models.ResponseDetails, *ModeArguments) error }
type HoverflyDiff ¶ added in v0.16.0
type HoverflyDiff interface { GetResponse(models.RequestDetails) (*models.ResponseDetails, *errors.HoverflyError) DoRequest(*http.Request) (*http.Response, error) AddDiff(requestView v2.SimpleRequestDefinitionView, diffReport v2.DiffReport) }
type HoverflyModify ¶
type HoverflyModify interface { ApplyMiddleware(models.RequestResponsePair) (models.RequestResponsePair, error) DoRequest(*http.Request) (*http.Response, error) }
type HoverflySimulate ¶
type HoverflySimulate interface { GetResponse(models.RequestDetails) (*models.ResponseDetails, *errors.HoverflyError) ApplyMiddleware(models.RequestResponsePair) (models.RequestResponsePair, error) }
type HoverflySpy ¶ added in v0.15.0
type HoverflySpy interface { GetResponse(models.RequestDetails) (*models.ResponseDetails, *errors.HoverflyError) ApplyMiddleware(models.RequestResponsePair) (models.RequestResponsePair, error) DoRequest(*http.Request) (*http.Response, error) }
type HoverflySynthesize ¶
type HoverflySynthesize interface { ApplyMiddleware(models.RequestResponsePair) (models.RequestResponsePair, error) IsMiddlewareSet() bool }
type Mode ¶
type Mode interface { Process(*http.Request, models.RequestDetails) (ProcessResult, error) SetArguments(arguments ModeArguments) View() v2.ModeView }
type ModeArguments ¶ added in v0.11.0
type ModifyMode ¶
type ModifyMode struct {
Hoverfly HoverflyModify
}
func (ModifyMode) Process ¶
func (this ModifyMode) Process(request *http.Request, details models.RequestDetails) (ProcessResult, error)
func (*ModifyMode) SetArguments ¶ added in v0.11.0
func (this *ModifyMode) SetArguments(arguments ModeArguments)
func (*ModifyMode) View ¶ added in v0.12.0
func (this *ModifyMode) View() v2.ModeView
type PostServeActionInputDetails ¶ added in v1.6.0
type PostServeActionInputDetails struct { PostServeAction string Pair *models.RequestResponsePair }
type ProcessResult ¶ added in v1.3.0
type ProcessResult struct { Response *http.Response FixedDelay int LogNormalDelay *models.ResponseDetailsLogNormal PostServeActionInputDetails *PostServeActionInputDetails }
func ErrorResponse ¶
func ErrorResponse(req *http.Request, err error, msg string) ProcessResult
func ReturnErrorAndLog ¶
func ReturnErrorAndLog(request *http.Request, err error, pair *models.RequestResponsePair, msg, mode string) (ProcessResult, error)
func (ProcessResult) IsResponseDelayable ¶ added in v1.3.0
func (p ProcessResult) IsResponseDelayable() bool
type SimulateMode ¶
type SimulateMode struct { Hoverfly HoverflySimulate MatchingStrategy string }
func (SimulateMode) Process ¶
func (this SimulateMode) Process(request *http.Request, details models.RequestDetails) (ProcessResult, error)
TODO: We should only need one of these two parameters
func (*SimulateMode) SetArguments ¶ added in v0.11.0
func (this *SimulateMode) SetArguments(arguments ModeArguments)
func (*SimulateMode) View ¶ added in v0.12.0
func (this *SimulateMode) View() v2.ModeView
type SpyMode ¶ added in v0.15.0
type SpyMode struct { Hoverfly HoverflySpy MatchingStrategy string }
func (SpyMode) Process ¶ added in v0.15.0
func (this SpyMode) Process(request *http.Request, details models.RequestDetails) (ProcessResult, error)
TODO: We should only need one of these two parameters
func (*SpyMode) SetArguments ¶ added in v0.15.0
func (this *SpyMode) SetArguments(arguments ModeArguments)
type SynthesizeMode ¶
type SynthesizeMode struct {
Hoverfly HoverflySynthesize
}
func (SynthesizeMode) Process ¶
func (this SynthesizeMode) Process(request *http.Request, details models.RequestDetails) (ProcessResult, error)
func (*SynthesizeMode) SetArguments ¶ added in v0.11.0
func (this *SynthesizeMode) SetArguments(arguments ModeArguments)
func (*SynthesizeMode) View ¶ added in v0.12.0
func (this *SynthesizeMode) View() v2.ModeView