Documentation
¶
Index ¶
- func Decolorize(s []byte) []byte
- func DumpRequest(req *http.Request) ([]byte, error)
- func ExpandPath(path string) string
- type Body
- type BodyMode
- type Response
- type ResponsesList
- func (rl *ResponsesList) Add(key string, r *Response) *ResponsesList
- func (rl *ResponsesList) Cur() *Response
- func (rl *ResponsesList) Del(key string) bool
- func (rl *ResponsesList) Get(key string) *Response
- func (rl *ResponsesList) Index() int
- func (rl *ResponsesList) Keys() []string
- func (rl *ResponsesList) Len() int
- func (rl *ResponsesList) Load(path string) error
- func (rl *ResponsesList) Next()
- func (rl *ResponsesList) Prev()
- func (rl *ResponsesList) Save(path string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decolorize ¶ added in v0.3.0
Decolorize remove the color escape sequences from a []byte encoded string
func DumpRequest ¶
DumpRequest pretty prints an http.Request
func ExpandPath ¶ added in v0.2.0
ExpandPath expands a given path by replacing '~' with $HOME of the current user.
Types ¶
type Body ¶ added in v0.2.0
Body is our response body content, that will either reference an local file or a runtime-supplied []byte.
type Response ¶
Response is the the preconfigured HTTP response that will be returned to the client.
func NewResponse ¶
NewResponse configures a new response. An empty status will be interpreted as 200 OK.
func (*Response) MarshalJSON ¶
MarshalJSON serializes the response into a JSON []byte.
func (*Response) UnmarshalJSON ¶
UnmarshalJSON inflates the Response from []byte representing JSON.
type ResponsesList ¶ added in v0.3.0
ResponsesList holds the multiple configured responses.
func NewResponsesList ¶ added in v0.3.0
func NewResponsesList() *ResponsesList
NewResponsesList creates a new empty response list and returns it.
func (*ResponsesList) Add ¶ added in v0.3.0
func (rl *ResponsesList) Add(key string, r *Response) *ResponsesList
Add appends a response item to the list. You need to supply a key for the item.
func (*ResponsesList) Cur ¶ added in v0.3.0
func (rl *ResponsesList) Cur() *Response
Cur retrieves the current response from the response list.
func (*ResponsesList) Del ¶ added in v0.3.0
func (rl *ResponsesList) Del(key string) bool
Del removes an item spceified by its key from the response list. It returns false if the item didn't exist at all.
func (*ResponsesList) Get ¶ added in v0.3.0
func (rl *ResponsesList) Get(key string) *Response
Get retrieves a specific response by name from the response list.
func (*ResponsesList) Index ¶ added in v0.3.0
func (rl *ResponsesList) Index() int
Index retrieves the index of the current item in the response list.
func (*ResponsesList) Keys ¶ added in v0.3.0
func (rl *ResponsesList) Keys() []string
Keys retrieves an []string of all keys in the response list.
func (*ResponsesList) Len ¶ added in v0.3.0
func (rl *ResponsesList) Len() int
Len reports the length of the response list.
func (*ResponsesList) Load ¶ added in v0.3.0
func (rl *ResponsesList) Load(path string) error
Load loads a response list from a local JSON document.
func (*ResponsesList) Next ¶ added in v0.3.0
func (rl *ResponsesList) Next()
Next iterates to the next item in the response list.
func (*ResponsesList) Prev ¶ added in v0.3.0
func (rl *ResponsesList) Prev()
Prev iterates to the previous item in the response list.
func (*ResponsesList) Save ¶ added in v0.3.0
func (rl *ResponsesList) Save(path string) error
Save saves the current response list to a JSON document on local disk.