Add NewResponse function

This commit is contained in:
Adnan Maolood 2021-02-24 10:48:17 -05:00
parent 19bfca1cc3
commit cb7879c966

View File

@ -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{}