translate

package
v2.3.7+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2018 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 HTTP

type HTTP struct {
}

HTTP is and adaptor beteewn the http and mock definition.

func (HTTP) BuildRequestDefinitionFromHTTP

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

BuildRequestDefinitionFromHTTP Read the request definition and return a mock request.

func (HTTP) WriteHTTPResponseFromDefinition

func (t HTTP) 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 checker 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