mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-13 18:03:10 -06:00
common/test/client: Don't panic on EOF in CanonicalJSONInput
This commit is contained in:
parent
2b166c0ca8
commit
9673792b48
|
|
@ -16,6 +16,7 @@ package test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
@ -58,7 +59,7 @@ func (r *LastRequestErr) Get() error {
|
||||||
func CanonicalJSONInput(jsonData []string) []string {
|
func CanonicalJSONInput(jsonData []string) []string {
|
||||||
for i := range jsonData {
|
for i := range jsonData {
|
||||||
jsonBytes, err := gomatrixserverlib.CanonicalJSON([]byte(jsonData[i]))
|
jsonBytes, err := gomatrixserverlib.CanonicalJSON([]byte(jsonData[i]))
|
||||||
if err != nil {
|
if err != nil && err != io.EOF {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
jsonData[i] = string(jsonBytes)
|
jsonData[i] = string(jsonBytes)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue