protected function detectFormatByHeaders(HeaderCollection $headers)
{
$contentType = $headers->get('content-type');
if (!empty($contentType)) {
if (stripos($contentType, 'json') !== false) {
return Client::FORMAT_JSON;
}
if (stripos($contentType, 'urlencoded') !== false) {
return Client::FORMAT_URLENCODED;
}
if (stripos($contentType, 'xml') !== false) {
return Client::FORMAT_XML;
}
}
return null;
}