translate

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPTranslator

type HTTPTranslator struct {
}

HTTPTranslator is and adaptor beteewn the http and mock definition.

func (HTTPTranslator) BuildRequestDefinitionFromHTTP

func (t HTTPTranslator) BuildRequestDefinitionFromHTTP(req *http.Request) definition.Request

BuildRequestDefinitionFromHTTP Read the request definition and return a mock request.

func (HTTPTranslator) WriteHTTPResponseFromDefinition

func (t HTTPTranslator) WriteHTTPResponseFromDefinition(fr *definition.Response, w http.ResponseWriter)

WriteHTTPResponseFromDefinition read a mock response and write a http response.

type MessageTranslator

type MessageTranslator interface {
	MockRequestBuilder
	MockResponseWriter
}

MessageTranslator defines the translator contract between http and mock and viceversa. this translation decople the mock matcher from the specific http implementation.

type MockRequestBuilder

type MockRequestBuilder interface {
	BuildRequestDefinitionFromHTTP(req *http.Request) definition.Request
}

MockRequestBuilder defines the translator from http.Request to definition.Request

type MockResponseWriter

type MockResponseWriter interface {
	WriteHTTPResponseFromDefinition(fr *definition.Response, w http.ResponseWriter)
}

MockResponseWriter defines the translator from definition.Response to http.ResponseWriter

Jump to

Keyboard shortcuts

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