summaryrefslogtreecommitdiff
path: root/response.go
diff options
context:
space:
mode:
authortjpcc <tjp@ctrl-c.club>2023-01-17 15:59:29 -0700
committertjpcc <tjp@ctrl-c.club>2023-01-17 15:59:29 -0700
commit2ef530daa47b301a40c1ee93cd43b8f36fc68c0b (patch)
treeb9753719f5f0e5312bb5008d40f40247ce14e15a /response.go
parent30e21f8513d49661cb6e1583d301e34e898d48a9 (diff)
pull request, response, handlers out of the gemini package
Diffstat (limited to 'response.go')
-rw-r--r--response.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/response.go b/response.go
new file mode 100644
index 0000000..5943552
--- /dev/null
+++ b/response.go
@@ -0,0 +1,28 @@
+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
+}