Merge 10349b43d11e65ddb82a5b3e803c581cce4d534d into 81dba468722f41347ed74ee66e9c1781d72f68a5

This commit is contained in:
ATUR 2026-02-22 00:22:53 +00:00 committed by GitHub
commit 7c50fe51ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -249,6 +249,15 @@ func TestRenderPureJSON(t *testing.T) {
assert.Equal(t, "application/json; charset=utf-8", w.Header().Get("Content-Type"))
}
func TestRenderPureJSONFail(t *testing.T) {
w := httptest.NewRecorder()
data := make(chan int)
// json: unsupported type: chan int
err := (PureJSON{data}).Render(w)
require.Error(t, err)
}
type xmlmap map[string]any
// Allows type H to be used with xml.Marshal
@ -401,6 +410,15 @@ func TestRenderXML(t *testing.T) {
assert.Equal(t, "application/xml; charset=utf-8", w.Header().Get("Content-Type"))
}
func TestRenderXMLFail(t *testing.T) {
w := httptest.NewRecorder()
data := make(chan int)
// xml: unsupported type: chan int
err := (XML{data}).Render(w)
require.Error(t, err)
}
func TestRenderRedirect(t *testing.T) {
req, err := http.NewRequest(http.MethodGet, "/test-redirect", nil)
require.NoError(t, err)