From 9673792b48df0f65fee6f2bec689a83370692b1a Mon Sep 17 00:00:00 2001 From: Robert Swain Date: Thu, 8 Jun 2017 10:39:26 +0200 Subject: [PATCH] common/test/client: Don't panic on EOF in CanonicalJSONInput --- src/github.com/matrix-org/dendrite/common/test/client.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/github.com/matrix-org/dendrite/common/test/client.go b/src/github.com/matrix-org/dendrite/common/test/client.go index c8d2a3037..1d2b478d8 100644 --- a/src/github.com/matrix-org/dendrite/common/test/client.go +++ b/src/github.com/matrix-org/dendrite/common/test/client.go @@ -16,6 +16,7 @@ package test import ( "fmt" + "io" "io/ioutil" "net/http" "sync" @@ -58,7 +59,7 @@ func (r *LastRequestErr) Get() error { func CanonicalJSONInput(jsonData []string) []string { for i := range jsonData { jsonBytes, err := gomatrixserverlib.CanonicalJSON([]byte(jsonData[i])) - if err != nil { + if err != nil && err != io.EOF { panic(err) } jsonData[i] = string(jsonBytes)