isJson property
bool
get
isJson
Check if response Content-Type is JSON.
Returns true if the response has Content-Type 'application/json'. Useful for verifying API responses return JSON.
Example:
expect(response.isJson, true);
final data = response.json; // Safe to parse
Implementation
bool get isJson {
final ct = contentType;
return ct != null && ct.mimeType == 'application/json';
}