-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for streamed response (#174)
- Loading branch information
1 parent
73f96b4
commit 46d8268
Showing
2 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,6 +69,25 @@ public function test_validates_invalid_json_response(): void | |
->assertValidationMessage('All array items must match schema'); | ||
} | ||
|
||
public function test_validates_valid_streamed_json_response(): void | ||
{ | ||
Route::get('/users', static function () { | ||
return response()->stream(function () { | ||
echo json_encode([ | ||
[ | ||
'id' => 1, | ||
'name' => 'Jim', | ||
'email' => '[email protected]', | ||
], | ||
]); | ||
}, 200, ['Content-Type' => 'application/json']); | ||
})->middleware(Middleware::class); | ||
|
||
$this->getJson('/users') | ||
->assertValidRequest() | ||
->assertValidResponse(); | ||
} | ||
|
||
public function test_validates_valid_problem_json_response() | ||
{ | ||
Route::get('/users', function () { | ||
|