client: Document use of contexts

This commit is contained in:
Adnan Maolood 2021-02-22 21:35:02 -05:00
parent d61cf6318a
commit 27299f537d

View File

@ -29,6 +29,8 @@ type Client struct {
}
// Get sends a Gemini request for the given URL.
// If the provided context is canceled or times out, the request
// will be aborted and the context's error will be returned.
//
// An error is returned if there was a Gemini protocol error.
// A non-2x status code doesn't cause an error.
@ -45,8 +47,9 @@ func (c *Client) Get(ctx context.Context, url string) (*Response, error) {
return c.Do(ctx, req)
}
// Do sends a Gemini request and returns a Gemini response, following
// policy as configured on the client.
// Do sends a Gemini request and returns a Gemini response.
// If the provided context is canceled or times out, the request
// will be aborted and the context's error will be returned.
//
// An error is returned if there was a Gemini protocol error.
// A non-2x status code doesn't cause an error.