Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bfd6b43

Browse files
committed
Merge pull request laravel#5849 from lucasmichot/4.2-http-getjsonoptions
[4.2] Http : add getJsonOptions to JsonResponse
2 parents 3c3a0bf + 0fd8728 commit bfd6b43

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

src/Illuminate/Http/JsonResponse.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,14 @@ public function setJsonOptions($options)
6565
return $this->setData($this->getData());
6666
}
6767

68+
/**
69+
* Get the JSON encoding options.
70+
*
71+
* @return int
72+
*/
73+
public function getJsonOptions()
74+
{
75+
return $this->jsonOptions;
76+
}
77+
6878
}

tests/Http/HttpJsonResponseTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,11 @@ public function testSetAndRetrieveData()
1010
$this->assertEquals('bar', $data->foo);
1111
}
1212

13+
public function testSetAndRetrieveOptions()
14+
{
15+
$response = new Illuminate\Http\JsonResponse(['foo' => 'bar']);
16+
$response->setJsonOptions(JSON_PRETTY_PRINT);
17+
$this->assertSame(JSON_PRETTY_PRINT, $response->getJsonOptions());
18+
}
19+
1320
}

0 commit comments

Comments
 (0)