Documentation ¶
Index ¶
- Variables
- type Option
- type ValidatingClient
- func (v *ValidatingClient) Delete(url string) (resp *http.Response, err error)
- func (v *ValidatingClient) Do(r *http.Request) (*http.Response, error)
- func (v *ValidatingClient) Get(url string) (resp *http.Response, err error)
- func (v *ValidatingClient) Head(url string) (resp *http.Response, err error)
- func (v *ValidatingClient) Post(url string, contentType string, body io.Reader) (resp *http.Response, err error)
- func (v *ValidatingClient) Put(url string, contentType string, body io.Reader) (resp *http.Response, err error)
- func (v *ValidatingClient) WithClient(c *http.Client) (*ValidatingClient, error)
- type Verifier
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(c *config)
func WithBasePath ¶
WithBasePath is a functional Option for setting the base path of the validator.
type ValidatingClient ¶
type ValidatingClient struct { *Verifier // contains filtered or unexported fields }
ValidatingClient provides an HTTP client, and wraps the main methods, recording any and all paths that are being called.
func WrapClient ¶
WrapClient takes an HTTP client and io.Reader for the OpenAPI spec. The spec is parsed, and wraps the client so that the outbound calls are now recorded when made.
func (*ValidatingClient) Delete ¶
func (v *ValidatingClient) Delete(url string) (resp *http.Response, err error)
Delete records response for HTTP DELETE requests
func (*ValidatingClient) Do ¶
Do takes any http.Request, sends it to the server it and then records the result.
func (*ValidatingClient) Get ¶
func (v *ValidatingClient) Get(url string) (resp *http.Response, err error)
Get is a convenience method for recording responses for HTTP GET requests
func (*ValidatingClient) Head ¶
func (v *ValidatingClient) Head(url string) (resp *http.Response, err error)
Head is a convenience method for recording responses for HTTP HEAD requests
func (*ValidatingClient) Post ¶
func (v *ValidatingClient) Post(url string, contentType string, body io.Reader) (resp *http.Response, err error)
Post is a convenience method for recording responses for HTTP POST requests
func (*ValidatingClient) Put ¶
func (v *ValidatingClient) Put(url string, contentType string, body io.Reader) (resp *http.Response, err error)
Put is a convenience method for recording responses for HTTP PUT requests
func (*ValidatingClient) WithClient ¶
func (v *ValidatingClient) WithClient(c *http.Client) (*ValidatingClient, error)
WithClient returns a new client using the same validator, but a new client. This can be useful to change transport or authorization settings, while still contributing to the same spec validation.
type Verifier ¶
type Verifier struct {
// contains filtered or unexported fields
}
func NewVerifier ¶
NewVerifier takes bytes for an OpenAPI spec and a base path, and then returns a new Verifier that contains the declared paths.