summary refs log tree commit diff stats
path: root/query.go
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-05-27 23:22:25 -0400
committerBen Morrison <ben@gbmor.dev>2019-05-27 23:22:25 -0400
commit9d55d0b478f386aca48d8eeacbbfd4bd3b387bc0 (patch)
tree390f4cfc456baf633d40cd3f0e66fc27b13d769c /query.go
parent73f58c1e901082441b0ce9497b35cd9d80bd7f7d (diff)
downloadgetwtxt-9d55d0b478f386aca48d8eeacbbfd4bd3b387bc0.tar.gz
parseQueryOut() no longer adds newline to last element, test updated to account for this
Diffstat (limited to 'query.go')
-rw-r--r--query.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/query.go b/query.go
index e74e109..6b9792b 100644
--- a/query.go
+++ b/query.go
@@ -24,10 +24,10 @@ func apiErrCheck(err error, r *http.Request) {
 func parseQueryOut(out []string) []byte {
 	var data []byte
 
-	for _, e := range out {
+	for i, e := range out {
 		data = append(data, []byte(e)...)
 
-		if !strings.HasSuffix(e, "\n") {
+		if !strings.HasSuffix(e, "\n") && i != len(out)-1 {
 			data = append(data, byte('\n'))
 		}
 	}