1
0
mirror of https://git.sr.ht/~adnano/go-gemini synced 2024-09-28 15:21:23 +02:00

Add NewResponse function

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

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