hasJsonBody function

Matcher hasJsonBody(
  1. dynamic expected
)

Matches an HTTP response with the specified JSON body.

The matcher performs deep comparison of the JSON structure. Use equals for exact matching or other matchers for partial matching.

Examples:

// Exact JSON matching
expect(response, hasJsonBody({'name': 'John', 'age': 30}));

// Partial matching with other matchers
expect(response, hasJsonBody(containsPair('name', 'John')));

Implementation

Matcher hasJsonBody(dynamic expected) => _HasJsonBodyMatcher(expected);