mock

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mock

type Mock struct {
	Request  Request  `yaml:"request"`
	Response Response `yaml:"response"`
}

Mock holds the data of one mock defined by the user. Mock.Request is the structure of the request. Mock.Response is the structure of the response.

type RIM

type RIM struct {
	Mocks []Mock `yaml:"mocks"`
}

RIM holds the data of all mocks defined by the user. RIM.Mocks holds the data of all mocks defined by the user.

func NewMocks

func NewMocks(directory string) (rim RIM, err error)

NewMocks creates the RIM structure based on the files in the directory.

type Request

type Request struct {
	Method string `yaml:"method"`
	Path   string `yaml:"path"`
}

Request is the structure of the request. Request.Method HTTP method of the request. Request.Path is the endpoint of the request.

type Response

type Response struct {
	Body interface{} `yaml:"body"`
	Code uint16      `yaml:"code"`
}

Response is the structure of the response. Response.Code the status code of the response. Response.Body is the content that the server will send.

Jump to

Keyboard shortcuts

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