From 600a2b0eba2ba1bd47bd194a1f4cacb3df2dc520 Mon Sep 17 00:00:00 2001 From: Willian Date: Thu, 9 Oct 2014 18:34:44 -0300 Subject: [PATCH] Search Content-Type header with regexp --- src/Curl/Curl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Curl/Curl.php b/src/Curl/Curl.php index 47aa6e3..ddbb2d7 100644 --- a/src/Curl/Curl.php +++ b/src/Curl/Curl.php @@ -354,7 +354,7 @@ class Curl $raw_response = $response; if (isset($response_headers['Content-Type'])) { - if (in_array($response_headers['Content-Type'], array('application/json', 'application/vnd.api+json'))) { + if (preg_match('~^application/(?:json|vnd\.api\+json)~i', $response_headers['Content-Type'])) { $json_obj = json_decode($response, false); if ($json_obj !== null) { $response = $json_obj;