Skip to content

Commit

Permalink
fixes #15 - retrieve content type from environment if exists
Browse files Browse the repository at this point in the history
  • Loading branch information
jaymoulin committed Nov 8, 2017
1 parent 0deeb02 commit ba3f641
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/Request/Factory.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace FMUP\Request;

class Factory
Expand Down Expand Up @@ -27,7 +28,8 @@ private function isCli()
private function isJson()
{
$headers = !$this->isCli() ? (array)$this->getHeaders() : [];
return isset($headers[self::CONTENT_TYPE]) && in_array(self::JSON_HEADER, (array)$headers[self::CONTENT_TYPE]);
return getenv(self::CONTENT_TYPE) == self::JSON_HEADER ||
(isset($headers[self::CONTENT_TYPE]) && in_array(self::JSON_HEADER, (array)$headers[self::CONTENT_TYPE]));
}

private function getHeaders()
Expand Down

0 comments on commit ba3f641

Please sign in to comment.