Skip to main content

HTTP Response Schema

Compare the runtime schema to the expected schema for HTTP response body.

This assertion checks the body of an HTTP response and identifies differences. It automatically checks for known content types like JSON and gRPC to compare key by key, if possible.

If no content type is identified, the default comparison is a simple hash compare.

Example with Ignore

{
"type": "httpResponseSchema",
"config": {
"ignore": "Authorization,errorCode,user.metaData.sessionId",
"matchType": "true",
"allowNew": "true"
}
}

Example with Include Only

{
"type": "httpResponseSchema",
"config": {
"includeOnly": "firstName,lastName,DOB.day,DOB.month",
"matchType": "true",
"allowNew": "true"
}
}

Configuration

KeyDescription
ignoreComma-separated list of JSON Paths that will be ignored during comparison. A key will match if it contains one of the ignored strings anywhere in the path. For example, an ignore string of errorCode will prevent the comparison of foo.bar.errorCode,errorCode, and foo.errorCode.barfrom being compared.
includeOnlyComma-separated JSON Paths that will be included during comparison. All other keys will be ignored. Given strings work the same as for ignore.
matchTypeValidate that values are the same type. For example, a field with a recorded value of "seventeen" and a replayed value of 17 would fail.
allowNewAllow new fields in the replay response which do not exist in the recorded response.

Notes

  • gRPC payloads are first decoded into JSON using a pseudo-human readable key format.