summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--query.go4
-rw-r--r--query_test.go6
2 files changed, 2 insertions, 8 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'))
 		}
 	}
diff --git a/query_test.go b/query_test.go
index 835ba90..28fb32d 100644
--- a/query_test.go
+++ b/query_test.go
@@ -40,12 +40,6 @@ func Test_parseQueryOut(t *testing.T) {
 
 		conv := strings.Split(string(out), "\n")
 
-		// It likes to append an empty element to the end.
-		// I need to fix that in the library.
-		if len(conv) > 0 && conv[len(conv)-1] == "" {
-			conv = conv[:len(conv)-1]
-		}
-
 		if !reflect.DeepEqual(data, conv) {
 			t.Errorf("Pre- and Post- parseQueryOut data are inequal:\n%#v\n%#v\n", data, conv)
 		}