expectsJsonFor static method
expectsJson for the headers of a request.
Implementation
static bool expectsJsonFor(HttpHeaders headers) {
if (headers.value('x-inertia') != null) return false;
String accept = headers.value(HttpHeaders.acceptHeader) ?? '';
if (accept.contains('/json') || accept.contains('+json')) return true;
return HttpBody.isJson(HttpBody.contentTypeOf(headers)) ||
headers.value('x-requested-with') == 'XMLHttpRequest';
}