diff options
Diffstat (limited to 'finger/response.go')
-rw-r--r-- | finger/response.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/finger/response.go b/finger/response.go new file mode 100644 index 0000000..07ca9a1 --- /dev/null +++ b/finger/response.go @@ -0,0 +1,22 @@ +package finger + +import ( + "bytes" + "io" + "strings" + + "tildegit.org/tjp/gus" +) + +// Error produces a finger Response containing the error message and Status 1. +func Error(msg string) *gus.Response { + if !strings.HasSuffix(msg, "\r\n") { + msg += "\r\n" + } + return &gus.Response{Body: bytes.NewBufferString(msg), Status: 1} +} + +// Success produces a finger response with a Status of 0. +func Success(body io.Reader) *gus.Response { + return &gus.Response{Body: body} +} |