Use responseWriter.Body.Bytes() (#4759)
staticcheck cleanup: https://staticcheck.io/docs/checks#S1030
This commit is contained in:
parent
0e9ac0c638
commit
4df94d5215
|
|
@ -1272,7 +1272,7 @@ func TestNewECDSARegistration(t *testing.T) {
|
||||||
wfe.NewRegistration(ctx, newRequestEvent(), responseWriter, makePostRequest(result.FullSerialize()))
|
wfe.NewRegistration(ctx, newRequestEvent(), responseWriter, makePostRequest(result.FullSerialize()))
|
||||||
|
|
||||||
var reg core.Registration
|
var reg core.Registration
|
||||||
err = json.Unmarshal([]byte(responseWriter.Body.String()), ®)
|
err = json.Unmarshal(responseWriter.Body.Bytes(), ®)
|
||||||
test.AssertNotError(t, err, "Couldn't unmarshal returned registration object")
|
test.AssertNotError(t, err, "Couldn't unmarshal returned registration object")
|
||||||
test.Assert(t, len(*reg.Contact) >= 1, "No contact field in registration")
|
test.Assert(t, len(*reg.Contact) >= 1, "No contact field in registration")
|
||||||
test.AssertEquals(t, (*reg.Contact)[0], "mailto:person@mail.com")
|
test.AssertEquals(t, (*reg.Contact)[0], "mailto:person@mail.com")
|
||||||
|
|
@ -1331,7 +1331,7 @@ func TestEmptyRegistration(t *testing.T) {
|
||||||
|
|
||||||
// We should get back a populated Registration
|
// We should get back a populated Registration
|
||||||
var reg core.Registration
|
var reg core.Registration
|
||||||
err = json.Unmarshal([]byte(responseWriter.Body.String()), ®)
|
err = json.Unmarshal(responseWriter.Body.Bytes(), ®)
|
||||||
test.AssertNotError(t, err, "Couldn't unmarshal returned registration object")
|
test.AssertNotError(t, err, "Couldn't unmarshal returned registration object")
|
||||||
test.Assert(t, len(*reg.Contact) >= 1, "No contact field in registration")
|
test.Assert(t, len(*reg.Contact) >= 1, "No contact field in registration")
|
||||||
test.AssertEquals(t, (*reg.Contact)[0], "mailto:person@mail.com")
|
test.AssertEquals(t, (*reg.Contact)[0], "mailto:person@mail.com")
|
||||||
|
|
@ -1466,7 +1466,7 @@ func TestNewRegistration(t *testing.T) {
|
||||||
makePostRequest(result.FullSerialize()))
|
makePostRequest(result.FullSerialize()))
|
||||||
|
|
||||||
var reg core.Registration
|
var reg core.Registration
|
||||||
err = json.Unmarshal([]byte(responseWriter.Body.String()), ®)
|
err = json.Unmarshal(responseWriter.Body.Bytes(), ®)
|
||||||
test.AssertNotError(t, err, "Couldn't unmarshal returned registration object")
|
test.AssertNotError(t, err, "Couldn't unmarshal returned registration object")
|
||||||
test.Assert(t, len(*reg.Contact) >= 1, "No contact field in registration")
|
test.Assert(t, len(*reg.Contact) >= 1, "No contact field in registration")
|
||||||
test.AssertEquals(t, (*reg.Contact)[0], "mailto:person@mail.com")
|
test.AssertEquals(t, (*reg.Contact)[0], "mailto:person@mail.com")
|
||||||
|
|
@ -1856,7 +1856,7 @@ func TestAuthorization(t *testing.T) {
|
||||||
test.AssertUnmarshaledEquals(t, responseWriter.Body.String(), `{"identifier":{"type":"dns","value":"test.com"}}`)
|
test.AssertUnmarshaledEquals(t, responseWriter.Body.String(), `{"identifier":{"type":"dns","value":"test.com"}}`)
|
||||||
|
|
||||||
var authz core.Authorization
|
var authz core.Authorization
|
||||||
err := json.Unmarshal([]byte(responseWriter.Body.String()), &authz)
|
err := json.Unmarshal(responseWriter.Body.Bytes(), &authz)
|
||||||
test.AssertNotError(t, err, "Couldn't unmarshal returned authorization object")
|
test.AssertNotError(t, err, "Couldn't unmarshal returned authorization object")
|
||||||
|
|
||||||
// Expired authorizations should be inaccessible
|
// Expired authorizations should be inaccessible
|
||||||
|
|
@ -1942,7 +1942,7 @@ func TestAuthorizationChallengeNamespace(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
var authz core.Authorization
|
var authz core.Authorization
|
||||||
err := json.Unmarshal([]byte(responseWriter.Body.String()), &authz)
|
err := json.Unmarshal(responseWriter.Body.Bytes(), &authz)
|
||||||
test.AssertNotError(t, err, "Couldn't unmarshal returned authorization object")
|
test.AssertNotError(t, err, "Couldn't unmarshal returned authorization object")
|
||||||
test.AssertEquals(t, len(authz.Challenges), 1)
|
test.AssertEquals(t, len(authz.Challenges), 1)
|
||||||
// The Challenge Error Type should have its prefix unmodified
|
// The Challenge Error Type should have its prefix unmodified
|
||||||
|
|
@ -1957,7 +1957,7 @@ func TestAuthorizationChallengeNamespace(t *testing.T) {
|
||||||
URL: mustParseURL(authzURL),
|
URL: mustParseURL(authzURL),
|
||||||
})
|
})
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(responseWriter.Body.String()), &authz)
|
err = json.Unmarshal(responseWriter.Body.Bytes(), &authz)
|
||||||
test.AssertNotError(t, err, "Couldn't unmarshal returned authorization object")
|
test.AssertNotError(t, err, "Couldn't unmarshal returned authorization object")
|
||||||
test.AssertEquals(t, len(authz.Challenges), 1)
|
test.AssertEquals(t, len(authz.Challenges), 1)
|
||||||
// The Challenge Error Type should have had the probs.V1ErrorNS prefix added
|
// The Challenge Error Type should have had the probs.V1ErrorNS prefix added
|
||||||
|
|
|
||||||
|
|
@ -1618,7 +1618,7 @@ func TestAuthorizationChallengeNamespace(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
var authz core.Authorization
|
var authz core.Authorization
|
||||||
err := json.Unmarshal([]byte(responseWriter.Body.String()), &authz)
|
err := json.Unmarshal(responseWriter.Body.Bytes(), &authz)
|
||||||
test.AssertNotError(t, err, "Couldn't unmarshal returned authorization object")
|
test.AssertNotError(t, err, "Couldn't unmarshal returned authorization object")
|
||||||
test.AssertEquals(t, len(authz.Challenges), 1)
|
test.AssertEquals(t, len(authz.Challenges), 1)
|
||||||
// The Challenge Error Type should have its prefix unmodified
|
// The Challenge Error Type should have its prefix unmodified
|
||||||
|
|
@ -1632,7 +1632,7 @@ func TestAuthorizationChallengeNamespace(t *testing.T) {
|
||||||
URL: mustParseURL("56"),
|
URL: mustParseURL("56"),
|
||||||
})
|
})
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(responseWriter.Body.String()), &authz)
|
err = json.Unmarshal(responseWriter.Body.Bytes(), &authz)
|
||||||
test.AssertNotError(t, err, "Couldn't unmarshal returned authorization object")
|
test.AssertNotError(t, err, "Couldn't unmarshal returned authorization object")
|
||||||
test.AssertEquals(t, len(authz.Challenges), 1)
|
test.AssertEquals(t, len(authz.Challenges), 1)
|
||||||
// The Challenge Error Type should have had the probs.V2ErrorNS prefix added
|
// The Challenge Error Type should have had the probs.V2ErrorNS prefix added
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue