Documentation ¶
Index ¶
- type Request
- type RequestOption
- type Response
- type ResponseAssertion
- type T
- func (t *T) AddPersistentOpts(opts ...RequestOption)
- func (t *T) Delete(opts ...RequestOption) Request
- func (t *T) Get(opts ...RequestOption) Request
- func (t *T) Head(opts ...RequestOption) Request
- func (t *T) Patch(opts ...RequestOption) Request
- func (t *T) Post(opts ...RequestOption) Request
- func (t *T) Put(opts ...RequestOption) Request
- func (t T) Request(method string, opts ...RequestOption) Request
- func (t *T) Run(name string, fn func(t *T))
- func (t *T) RunPath(elem string, fn func(t *T))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request represents a pending HTTP request.
type RequestOption ¶
RequestOption modifies a request. Use the passed t to fail if the option cannot be set.
func CombineRequestOptions ¶
func CombineRequestOptions(opts ...RequestOption) RequestOption
CombineRequestOptions returns a new RequestOption which internally calls each member of options in the provided order.
func URLParams ¶
func URLParams(v url.Values) RequestOption
URLParams sets the URL parameters of the request.
type Response ¶
Response represents an HTTP response generated by hat.Request.
func (Response) Assert ¶
func (r Response) Assert(t testing.TB, assertions ...ResponseAssertion) Response
Assert runs each requireion against the response. It closes the response body after all of the requireions have ran. Assert must be called for every response as it will ensure the body is closed. If you want to continue to reuse the connection, you must read the response body.
type ResponseAssertion ¶
ResponseAssertion requires a quality of the response.
func CombineResponseAssertions ¶
func CombineResponseAssertions(as ...ResponseAssertion) ResponseAssertion
CombineResponseAssertions returns a new ResponseAssertion which internally calls each member of requires in the provided order.
type T ¶
type T struct { *testing.T URL *url.URL Client *http.Client // contains filtered or unexported fields }
T represents a test instance. It intentionally does not provide any default request modifiers or default response requireions. Defaults should be explicitly provided to Request and Assert.
func (*T) AddPersistentOpts ¶
func (t *T) AddPersistentOpts(opts ...RequestOption)
func (*T) Delete ¶
func (t *T) Delete(opts ...RequestOption) Request
func (*T) Get ¶
func (t *T) Get(opts ...RequestOption) Request
func (*T) Head ¶
func (t *T) Head(opts ...RequestOption) Request
func (*T) Patch ¶
func (t *T) Patch(opts ...RequestOption) Request
func (*T) Post ¶
func (t *T) Post(opts ...RequestOption) Request
func (*T) Put ¶
func (t *T) Put(opts ...RequestOption) Request
func (T) Request ¶
func (t T) Request(method string, opts ...RequestOption) Request
Request creates an HTTP request to the endpoint.
Directories ¶
Path | Synopsis |
---|---|
Package asshat provides common ResponseAssertions.
|
Package asshat provides common ResponseAssertions. |
examples
|
|