diff --git a/defaults.go b/defaults.go index 362d292f..4418c4d1 100644 --- a/defaults.go +++ b/defaults.go @@ -15,7 +15,9 @@ import ( // } var DefaultJSONFormat = Format{ Marshal: func(w io.Writer, v any) error { - return json.NewEncoder(w).Encode(v) + enc := json.NewEncoder(w) + enc.SetEscapeHTML(false) + return enc.Encode(v) }, Unmarshal: json.Unmarshal, } diff --git a/huma_test.go b/huma_test.go index 83e9747d..2e56a2fb 100644 --- a/huma_test.go +++ b/huma_test.go @@ -3002,7 +3002,7 @@ func TestCustomSchemaErrors(t *testing.T) { resp := api.Post("/test", map[string]any{"test": 1}) assert.Equal(t, http.StatusUnprocessableEntity, resp.Result().StatusCode) - assert.Contains(t, resp.Body.String(), `expected number \u003e= 10`) + assert.Contains(t, resp.Body.String(), `expected number >= 10`) } func TestBodyRace(t *testing.T) {