Back to godoc.org

Package pact

v0.0.5
Latest Go to latest

The highest tagged major version is .

Published: Feb 19, 2018 | License: Apache-2.0 | Module: bitbucket.org/atlassian/http-interaction-recorder

Index

func NewListener

func NewListener(consumer, provider string) recorder.Listener

type FileSystem

type FileSystem interface {
	PathExists(path string) (bool, error)
	CreatePath(path string) error
	OpenWriteStream(fileName string) (io.WriteCloser, error)
}

type Generator

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

func NewGenerator

func NewGenerator(consumer, provider string, options ...Option) *Generator

func (*Generator) ProcessInteraction

func (generator *Generator) ProcessInteraction(request recorder.Request, response recorder.Response) error

type IDGenerator

type IDGenerator interface {
	Generate() string
}

type Interaction

type Interaction struct {
	Request     Request  `json:"request"`
	Response    Response `json:"response"`
	Description string   `json:"description"`
}

type Listener

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

func (Listener) GetPactLocation

func (listener Listener) GetPactLocation() string

func (Listener) RequestReceived

func (listener Listener) RequestReceived(request recorder.Request, response recorder.Response)

type LocalFileSystem

type LocalFileSystem struct{}

func (*LocalFileSystem) CreatePath

func (fileSystem *LocalFileSystem) CreatePath(path string) error

func (*LocalFileSystem) OpenWriteStream

func (fileSystem *LocalFileSystem) OpenWriteStream(fileName string) (io.WriteCloser, error)

func (*LocalFileSystem) PathExists

func (fileSystem *LocalFileSystem) PathExists(path string) (bool, error)

type Option

type Option func(config *config)

func WithFileSystem

func WithFileSystem(fileSystem FileSystem) Option

func WithIDGenerator

func WithIDGenerator(idGenerator IDGenerator) Option

type Pact

type Pact struct {
	Consumer     Participant   `json:"consumer"`
	Provider     Participant   `json:"provider"`
	Interactions []Interaction `json:"interactions"`
}

func (*Pact) AddInteraction

func (pact *Pact) AddInteraction(interaction Interaction)

type Participant

type Participant struct {
	Name string `json:"name"`
}

type Request

type Request struct {
	Method  string            `json:"method"`
	Path    string            `json:"path"`
	Query   string            `json:"query,omitempty"`
	Headers map[string]string `json:"headers,omitempty"`
	Body    json.RawMessage   `json:"body,omitempty"`
}

type Response

type Response struct {
	Status  int               `json:"status"`
	Headers map[string]string `json:"headers,omitempty"`
	Body    json.RawMessage   `json:"body,omitempty"`
}

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier