model

package
v0.0.0-...-21bd515 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2017 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ValidStatusCodes = [...]int{100, 101, 200, 201, 202, 203, 204, 205, 206, 300, 301, 302, 303, 304, 305, 307, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 500, 501, 502, 503, 504, 505}

ValidStatusCodes is valid http status codes.

Functions

func GetMockFileName

func GetMockFileName(r *http.Request) string

GetMockFileName returns the base name of a mock.

func ValidateStatusCode

func ValidateStatusCode(code string) (int, error)

ValidateStatusCode checks if string is valid http code.

Types

type MockConf

type MockConf struct {
	URI         string            `json:"uri"`
	Method      string            `json:"method"`
	ContentType string            `json:"contenttype"`
	StatusCode  int               `json:"status"`
	Header      map[string]string `json:"header"`

	Errors map[string]string
}

MockConf represent a http call mock entity.

func ReadResponse

func ReadResponse(r *http.Response) *MockConf

ReadResponse from reading target response.

func (*MockConf) GetFileName

func (c *MockConf) GetFileName() string

GetFileName returns the filename for a MockConf enitiy.

func (*MockConf) String

func (c *MockConf) String() string

func (MockConf) Valid

func (c MockConf) Valid() (bool, map[string]string)

Valid returns true or false. Second argument is map containing errors. Key is field name and value is error message.

type MockConfs

type MockConfs []MockConf

MockConfs is a list of MockConf.

Jump to

Keyboard shortcuts

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