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. // 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. // An error is returned if there was a Gemini protocol error.
// A non-2x status code doesn't cause an 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) return c.Do(ctx, req)
} }
// Do sends a Gemini request and returns a Gemini response, following // Do sends a Gemini request and returns a Gemini response.
// policy as configured on the client. // 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. // An error is returned if there was a Gemini protocol error.
// A non-2x status code doesn't cause an error. // A non-2x status code doesn't cause an error.