src/Http/Formatting/HttpHeaderParser.php
public function isJson(HttpHeaders $headers): bool
    {
        $contentType = null;
        $headers->tryGetFirst('Content-Type', $contentType);

        return preg_match("/application\/json/i", $contentType) === 1;
    }
public function isJson(HttpHeaders $headers): bool
    {
        $contentType = null;
        $headers->tryGetFirst('Content-Type', $contentType);

        return preg_match("/application\/json/i", $contentType) === 1;
    }
Gets whether or not the headers have a JSON content type

@param HttpHeaders $headers The headers to parse
@return bool True if the message has a JSON content type, otherwise false
@throws RuntimeException Thrown if the content type header's hash key could not be calculated