mirror of
https://github.com/Fishwaldo/huma.git
synced 2025-03-15 19:31:27 +00:00
fix: make test JSON easier to read
This commit is contained in:
parent
a24e490b76
commit
065e5e3927
1 changed files with 13 additions and 2 deletions
|
@ -71,7 +71,12 @@ func TestNestedResolver(t *testing.T) {
|
|||
|
||||
// Test happy case just sending ONE of the two possible fields in each struct.
|
||||
w := httptest.NewRecorder()
|
||||
r, _ := http.NewRequest(http.MethodPost, "/", strings.NewReader(`{"foo": {"a": [{"one": "1"}], "b": [{"two": "2"}]}}`))
|
||||
r, _ := http.NewRequest(http.MethodPost, "/", strings.NewReader(`{
|
||||
"foo": {
|
||||
"a": [{"one": "1"}],
|
||||
"b": [{"two": "2"}]
|
||||
}
|
||||
}`))
|
||||
app.ServeHTTP(w, r)
|
||||
|
||||
assert.Equal(t, http.StatusNoContent, w.Result().StatusCode)
|
||||
|
@ -92,7 +97,13 @@ func TestNestedResolverError(t *testing.T) {
|
|||
// not allowed. Should get a validation error response generated by the
|
||||
// `Dep1.Resolve(...)` method above.
|
||||
w := httptest.NewRecorder()
|
||||
r, _ := http.NewRequest(http.MethodPost, "/", strings.NewReader(`{"foo": {"a": [{"one": "1", "two": "2"}]}}`))
|
||||
r, _ := http.NewRequest(http.MethodPost, "/", strings.NewReader(`{
|
||||
"foo": {
|
||||
"a": [
|
||||
{"one": "1", "two": "2"}
|
||||
]
|
||||
}
|
||||
}`))
|
||||
app.ServeHTTP(w, r)
|
||||
|
||||
assert.JSONEq(t, `{
|
||||
|
|
Loading…
Add table
Reference in a new issue