(t *testing.T)
| 233 | } |
| 234 | |
| 235 | func TestContextJSONErrorsOut(t *testing.T) { |
| 236 | e := New() |
| 237 | rec := httptest.NewRecorder() |
| 238 | req := httptest.NewRequest(http.MethodPost, "/", strings.NewReader(userJSON)) |
| 239 | c := e.NewContext(req, rec) |
| 240 | |
| 241 | err := c.JSON(http.StatusOK, make(chan bool)) |
| 242 | assert.EqualError(t, err, "json: unsupported type: chan bool") |
| 243 | |
| 244 | assert.Equal(t, http.StatusOK, rec.Code) // status code must not be sent to the client |
| 245 | assert.Empty(t, rec.Body.String()) // body must not be sent to the client |
| 246 | } |
| 247 | |
| 248 | func TestContextJSONWithNotEchoResponse(t *testing.T) { |
| 249 | e := New() |
nothing calls this directly
no test coverage detected
searching dependent graphs…