diff options
| author | Adnan Maolood <[email protected]> | 2021-02-24 10:48:17 -0500 |
|---|---|---|
| committer | Adnan Maolood <[email protected]> | 2021-02-24 10:48:17 -0500 |
| commit | cb7879c966a04f8a0b88237cf025bd39ecb9cd0f (patch) | |
| tree | 211d0615b3fd41e76fc25f25d120e2b2924a6f46 | |
| parent | examples/server: Cancel context (diff) | |
| download | go-gemini-cb7879c966a04f8a0b88237cf025bd39ecb9cd0f.tar.xz go-gemini-cb7879c966a04f8a0b88237cf025bd39ecb9cd0f.zip | |
Add NewResponse function
| -rw-r--r-- | response.go | 9 |
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{} |