diff options
| author | Adnan Maolood <[email protected]> | 2021-02-14 16:23:38 -0500 |
|---|---|---|
| committer | Adnan Maolood <[email protected]> | 2021-02-14 16:23:38 -0500 |
| commit | 0c303588a43f0e6a5146ac5c668aadcb4409952a (patch) | |
| tree | d1f8f16ac769bbb6ae603da3d55f43951e541413 /response.go | |
| parent | Remove StatusClass* constants (diff) | |
| download | go-gemini-0c303588a43f0e6a5146ac5c668aadcb4409952a.tar.xz go-gemini-0c303588a43f0e6a5146ac5c668aadcb4409952a.zip | |
Update Response documentation
Diffstat (limited to 'response.go')
| -rw-r--r-- | response.go | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/response.go b/response.go index d97740a..5d8558e 100644 --- a/response.go +++ b/response.go @@ -7,7 +7,11 @@ import ( "strconv" ) -// Response is a Gemini response. +// Response represents the response from a Gemini request. +// +// The Client returns Responses from servers once the response +// header has been received. The response body is streamed on demand +// as the Body field is read. type Response struct { // Status contains the response status code. Status int @@ -19,13 +23,19 @@ type Response struct { Meta string // Body represents the response body. - // Body is guaranteed to always be non-nil. // - // The response body is streamed on demand as the Body field is read. + // The response body is streamed on demand as the Body field + // is read. If the network connection fails or the server + // terminates the response, Body.Read calls return an error. + // + // The Gemini client guarantees that Body is always + // non-nil, even on responses without a body or responses with + // a zero-length body. It is the caller's responsibility to + // close Body. Body io.ReadCloser - // TLS contains information about the TLS connection on which the response - // was received. + // TLS contains information about the TLS connection on which the + // response was received. It is nil for unencrypted responses. TLS *tls.ConnectionState } |