summaryrefslogtreecommitdiff
path: root/finger/response.go
blob: 07ca9a17e43d043d95896e4f64d1559667e92670 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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}
}