Skip to content

Commit 51be6e0

Browse files
committed
merge develop
2 parents 7a3e3a8 + 87a820b commit 51be6e0

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

src/JsonResponse.php

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,27 @@
99

1010
namespace FastD\Http;
1111

12-
1312
/**
1413
* Class JsonResponse
15-
*
1614
* @package FastD\Http
1715
*/
1816
class JsonResponse extends Response
1917
{
2018
const JSON_OPTIONS = JSON_UNESCAPED_UNICODE;
19+
const CONTENT_TYPE = 'application/json; charset=UTF-8';
2120

2221
/**
2322
* Constructor.
2423
*
25-
* @param mixed $data The response data
24+
* @param array $data
2625
* @param int $status The response status code
2726
* @param array $headers An array of response headers
28-
* @param string $version
27+
* @param string $version The response protocol version
2928
*/
30-
public function __construct(array $data, $status = 200, array $headers = array(), $version = '1.1')
29+
public function __construct(array $data, $status = 200, array $headers = [], $version = '1.1')
3130
{
32-
$this->withContentType('application/json; charset=UTF-8');
31+
$this->withContentType(static::CONTENT_TYPE);
3332

3433
parent::__construct(json_encode($data, static::JSON_OPTIONS), $status, $headers, $version);
3534
}
36-
37-
/**
38-
* @return mixed
39-
*/
40-
public function toArray()
41-
{
42-
return json_decode($this->getContents(), true);
43-
}
4435
}

src/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function __construct($method, $uri, array $headers = [], StreamInterface
7373
$this->withMethod($method);
7474
$this->withUri(new Uri($uri));
7575
$this->withHeaders($headers);
76-
76+
7777
parent::__construct($body);
7878
}
7979

0 commit comments

Comments
 (0)