summaryrefslogtreecommitdiff
path: root/response.go
diff options
context:
space:
mode:
authortjpcc <tjp@ctrl-c.club>2023-08-12 09:40:39 -0600
committertjpcc <tjp@ctrl-c.club>2023-08-12 09:40:39 -0600
commit23bc5f4fb7542e64c94eaa7fe2c7a6aa55010898 (patch)
treeec8113d3aa2379e3ca9cb3c6e13a5531895ea8c0 /response.go
parent57a31a9b2cd549174d839b9b91b47db337f174cc (diff)
move common types to an internal package
This helps avoid import cycles.
Diffstat (limited to 'response.go')
-rw-r--r--response.go36
1 files changed, 4 insertions, 32 deletions
diff --git a/response.go b/response.go
index 249e08f..bb7c2bb 100644
--- a/response.go
+++ b/response.go
@@ -1,35 +1,7 @@
package sliderule
-import "io"
+import "tildegit.org/tjp/sliderule/internal/types"
-// 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
-}
-
-// ResponseReader is an object which can serialize a response to a protocol.
-type ResponseReader interface {
- io.Reader
- io.WriterTo
- io.Closer
-}
+type Status = types.Status
+type Response = types.Response
+type ResponseReader = types.ResponseReader