Update Response documentation
This commit is contained in:
parent
37e5686764
commit
0c303588a4
20
response.go
20
response.go
@ -7,7 +7,11 @@ import (
|
|||||||
"strconv"
|
"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 {
|
type Response struct {
|
||||||
// Status contains the response status code.
|
// Status contains the response status code.
|
||||||
Status int
|
Status int
|
||||||
@ -19,13 +23,19 @@ type Response struct {
|
|||||||
Meta string
|
Meta string
|
||||||
|
|
||||||
// Body represents the response body.
|
// 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
|
Body io.ReadCloser
|
||||||
|
|
||||||
// TLS contains information about the TLS connection on which the response
|
// TLS contains information about the TLS connection on which the
|
||||||
// was received.
|
// response was received. It is nil for unencrypted responses.
|
||||||
TLS *tls.ConnectionState
|
TLS *tls.ConnectionState
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package gemini
|
package gemini
|
||||||
|
|
||||||
// Status codes.
|
// Gemini status codes.
|
||||||
const (
|
const (
|
||||||
StatusInput = 10
|
StatusInput = 10
|
||||||
StatusSensitiveInput = 11
|
StatusSensitiveInput = 11
|
||||||
@ -23,7 +23,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// StatusClass returns the status class for this status code.
|
// StatusClass returns the status class for this status code.
|
||||||
// 1x becomes 10, 2x becomes 20, etc.
|
// 1x becomes 10, 2x becomes 20, and so on.
|
||||||
func StatusClass(status int) int {
|
func StatusClass(status int) int {
|
||||||
return (status / 10) * 10
|
return (status / 10) * 10
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user