This repository has been archived on 2023-05-01. You can view files and clone it, but cannot push or open issues or pull requests.
2023-01-17 22:59:29 +00:00
|
|
|
package gus
|
|
|
|
|
|
|
|
import "io"
|
|
|
|
|
|
|
|
// Status is the integer status code of a response.
|
|
|
|
type Status int
|
|
|
|
|
|
|
|
// Response contains the data in a response over the small web.
|
|
|
|
//
|
|
|
|
// Because protocols have so many differences, this type represents a
|
|
|
|
// greatest common denominator of request/response-oriented protocols.
|
|
|
|
type Response struct {
|
|
|
|
// Status is the status code of the response.
|
|
|
|
Status Status
|
|
|
|
|
|
|
|
// Meta contains status-specific additional information.
|
|
|
|
Meta any
|
|
|
|
|
|
|
|
// Body is the response body, if any.
|
|
|
|
Body io.Reader
|
|
|
|
}
|
|
|
|
|
|
|
|
func (response *Response) Close() error {
|
|
|
|
if cl, ok := response.Body.(io.Closer); ok {
|
|
|
|
return cl.Close()
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
2023-01-28 21:52:35 +00:00
|
|
|
|
|
|
|
// ResponseReader is an object which can serialize a response to a protocol.
|
|
|
|
type ResponseReader interface {
|
|
|
|
io.Reader
|
|
|
|
io.WriterTo
|
|
|
|
io.Closer
|
|
|
|
}
|