mirror of https://github.com/ory/kratos
test: add assertions for json response body
GitOrigin-RevId: b9ff0ad8e58bf96953980bb8aeb55aeee8138c04
This commit is contained in:
parent
286f885e20
commit
0f5085c67a
|
|
@ -178,6 +178,9 @@ func InitializeLoginFlowViaBrowser(t *testing.T, client *http.Client, ts *httpte
|
|||
res, err := client.Do(req.WithContext(o.Context()))
|
||||
require.NoError(t, err)
|
||||
body := x.MustReadAll(res.Body)
|
||||
if isSPA {
|
||||
require.True(t, gjson.ValidBytes(body), "body is not valid JSON: %s", string(body))
|
||||
}
|
||||
require.NoError(t, res.Body.Close())
|
||||
require.Equal(t, 200, res.StatusCode, "%s", body)
|
||||
if expectInitError {
|
||||
|
|
|
|||
|
|
@ -53,6 +53,9 @@ func InitializeRegistrationFlowViaBrowser(t *testing.T, client *http.Client, ts
|
|||
res, err := client.Do(req)
|
||||
require.NoError(t, err)
|
||||
body := x.MustReadAll(res.Body)
|
||||
if isSPA {
|
||||
require.True(t, gjson.ValidBytes(body), "body is not valid JSON: %s", string(body))
|
||||
}
|
||||
require.NoError(t, res.Body.Close())
|
||||
if expectInitError {
|
||||
require.Equal(t, 200, res.StatusCode)
|
||||
|
|
|
|||
Loading…
Reference in New Issue