mirror of
https://github.com/pocketbase/pocketbase.git
synced 2026-10-21 21:44:04 +02:00
(experimental) upgraded to encoding/json/v2
This commit is contained in:
1 parent
4d4275c9aa
commit
97dd775455
125 files changed
+433
-364
No files matched your search
+6
-4
@@ -3,7 +3,7 @@ package tests
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
"maps"
|
||||
@@ -259,14 +259,16 @@ func (scenario *ApiScenario) test(t testing.TB) {
|
||||
}
|
||||
} else {
|
||||
// normalize json response format
|
||||
buffer := new(bytes.Buffer)
|
||||
err := json.Compact(buffer, recorder.Body.Bytes())
|
||||
var normalizedBody string
|
||||
|
||||
buf := new(bytes.Buffer)
|
||||
enc := jsontext.NewEncoder(buf)
|
||||
err := enc.WriteValue(recorder.Body.Bytes())
|
||||
if err != nil {
|
||||
// not a json...
|
||||
normalizedBody = recorder.Body.String()
|
||||
} else {
|
||||
normalizedBody = buffer.String()
|
||||
normalizedBody = buf.String()
|
||||
}
|
||||
|
||||
for _, item := range scenario.ExpectedContent {
|
||||
|
||||
Reference in new issue
Block a user