BodyEquals asserts the content from the response recorder with the encoded json of the provided instance.
(t assert.TestingT, obj interface{}, recorder *httptest.ResponseRecorder)
| 11 | |
| 12 | // BodyEquals asserts the content from the response recorder with the encoded json of the provided instance. |
| 13 | func BodyEquals(t assert.TestingT, obj interface{}, recorder *httptest.ResponseRecorder) { |
| 14 | bytes, err := io.ReadAll(recorder.Body) |
| 15 | assert.Nil(t, err) |
| 16 | actual := string(bytes) |
| 17 | |
| 18 | JSONEquals(t, obj, actual) |
| 19 | } |
| 20 | |
| 21 | // JSONEquals asserts the content of the string with the encoded json of the provided instance. |
| 22 | func JSONEquals(t assert.TestingT, obj interface{}, expected string) { |
searching dependent graphs…