aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdnan Maolood <[email protected]>2021-02-24 10:48:17 -0500
committerAdnan Maolood <[email protected]>2021-02-24 10:48:17 -0500
commitcb7879c966a04f8a0b88237cf025bd39ecb9cd0f (patch)
tree211d0615b3fd41e76fc25f25d120e2b2924a6f46
parentexamples/server: Cancel context (diff)
downloadgo-gemini-cb7879c966a04f8a0b88237cf025bd39ecb9cd0f.tar.xz
go-gemini-cb7879c966a04f8a0b88237cf025bd39ecb9cd0f.zip
Add NewResponse function
-rw-r--r--response.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/response.go b/response.go
index 594fda2..d89fcb7 100644
--- a/response.go
+++ b/response.go
@@ -26,6 +26,15 @@ type Response struct {
conn net.Conn
}
+// NewResponse returns a new response with the provided status, meta, and body.
+func NewResponse(status Status, meta string, body io.ReadCloser) *Response {
+ return &Response{
+ status: status,
+ meta: meta,
+ body: body,
+ }
+}
+
// ReadResponse reads a Gemini response from the provided io.ReadCloser.
func ReadResponse(r io.ReadCloser) (*Response, error) {
resp := &Response{}