Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Definition ¶
type Definition struct { URI string Description string `json:"description"` Request Request `json:"request"` Response Response `json:"response"` Callback Callback `json:"callback"` Control Control `json:"control"` }
Definition contains the user mock config
type Delay ¶
func (*Delay) UnmarshalJSON ¶
type HTTP ¶
type HTTP struct { }
HTTP is and adaptor beteewn the http and mock config.
func (HTTP) BuildRequestDefinitionFromHTTP ¶
BuildRequestDefinitionFromHTTP Read the request config and return a mock request.
func (HTTP) WriteHTTPResponseFromDefinition ¶
func (t HTTP) WriteHTTPResponseFromDefinition(fr *Response, w http.ResponseWriter)
WriteHTTPResponseFromDefinition read a mock response and write a http response.
type HttpHeaders ¶
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 ¶
MockRequestBuilder defines the translator from http.Request to config.Request
type MockResponseWriter ¶
type MockResponseWriter interface {
WriteHTTPResponseFromDefinition(fr *Response, w http.ResponseWriter)
}
MockResponseWriter defines the translator from config.Response to http.ResponseWriter
type Response ¶
type Response struct { StatusCode int `json:"statusCode"` HttpHeaders Body string `json:"body"` }
Click to show internal directories.
Click to hide internal directories.