Documentation ¶
Index ¶
Constants ¶
View Source
const ( MethodGet string = "GET" MethodPost string = "POST" MethodPut string = "PUT" MethodPatch string = "PATCH" MethodDelete string = "DELETE" MethodOptions string = "OPTIONS" MethodHead string = "HEAD" )
Constants
Variables ¶
View Source
var ( ErrInvalidStatusCode = errors.New("Invalid status code") ErrNilOriginalResponse = errors.New("Nil original response") )
Variables
Functions ¶
This section is empty.
Types ¶
type Configuration ¶
type Configuration struct {
MaxSizeBody int `json:"max_size_body"`
}
Configuration represents a JSON-friendly gozzle configuration
type Gozzle ¶
type Gozzle interface { Exec(reqSet RequestSet) ResponseSet MaxSizeBody() int SetMaxSizeBody(maxSizeBody int) Gozzle }
Gozzle represents an object capable of executing a set of requests
func NewGozzleFromConfiguration ¶
func NewGozzleFromConfiguration(c Configuration) Gozzle
NewGozzleFromConfiguration creates a new Gozzle object based on a configuration
type Request ¶
type Request interface { Name() string SetName(n string) Request Method() string SetMethod(m string) Request Path() string SetPath(p string) Request Headers() map[string]string SetHeaders(h map[string]string) Request AddHeader(k string, v string) Request GetHeader(k string) string DelHeader(k string) Request Query() map[string]string SetQuery(q map[string]string) Request AddQuery(k string, v string) Request GetQuery(k string) string DelQuery(k string) Request Body() interface{} SetBody(b interface{}) Request BodyReader() io.Reader SetBodyReader(reader io.Reader) Request BeforeHandler() func(r Request) bool SetBeforeHandler(f func(r Request) bool) Request AfterHandler() func(req Request, resp Response) SetAfterHandler(f func(req Request, resp Response)) Request FullPath() string }
Request represents a request sendable by gozzle
type RequestSet ¶
type RequestSet interface { Names() []string AddRequest(r Request) RequestSet GetRequest(name string) Request DelRequest(name string) RequestSet }
RequestSet represents a set of sendable requests
type Response ¶
type Response interface { Errors() []error Status() string StatusCode() int Header() http.Header BodyReader() io.ReadCloser Body() ([]byte, error) Close() error }
Response represents a response received by gozzle after sending a request
func NewResponse ¶
NewResponse creates a new response based on an *http.Response
func NewResponseError ¶
NewResponseError creates a new response with an error set by default
type ResponseSet ¶
type ResponseSet interface { Names() []string AddResponse(req Request, resp Response) ResponseSet GetResponse(name string) Response DelResponse(name string) ResponseSet Close() map[string]error }
ResponseSet represents a set of responses
Click to show internal directories.
Click to hide internal directories.