How to wait API streamed response in Laravel 9.x

Viewed 23

I have some code to download a csv file with orders information. So I created a Test to validate this route in my application and I can't get the full content from the streamedContent(). I using factory from laravel to simulate the data and I already tested content returned from factory.

This is my call to get file:

$response = $this->actingAs($user, 'file')->get("/link/to/get/csv/streamed/file");

I wanna get full content from streamed file to compare size from file and my data from orders. There's a way to await this call, store this file in variable, temporary download or something like this?

Reference for streamed http download:

https://laravel.com/docs/9.x/responses#streamed-downloads

Thanks in advance!

0 Answers
Related