File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
lib/Gitlab/HttpClient/Message Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 12
12
class ResponseMediator
13
13
{
14
14
/**
15
- * Return the response body as a string or json array if content type is application/json.
15
+ * The JSON content type identifier.
16
+ *
17
+ * @var string
18
+ */
19
+ const JSON_CONTENT_TYPE = 'application/json ' ;
20
+
21
+ /**
22
+ * Return the response body as a string or JSON array if content type is JSON.
16
23
*
17
24
* @param ResponseInterface $response
18
25
*
@@ -21,7 +28,7 @@ class ResponseMediator
21
28
public static function getContent (ResponseInterface $ response )
22
29
{
23
30
$ body = $ response ->getBody ()->__toString ();
24
- if (0 === strpos ($ response ->getHeaderLine ('Content-Type ' ), ' application/json ' )) {
31
+ if (0 === strpos ($ response ->getHeaderLine ('Content-Type ' ), self :: JSON_CONTENT_TYPE )) {
25
32
$ content = json_decode ($ body , true );
26
33
if (JSON_ERROR_NONE === json_last_error ()) {
27
34
return $ content ;
You can’t perform that action at this time.
0 commit comments