I transfer the file through call (), how to transfer headers?

$file = new UploadedFile(public_path('tests\images\test.png'), 'test.png', null, 'image/png', null, true); $filename = $this->call('POST', '/api/admin/upload', [], [], ['file' => $file], ['Accept' => 'application/json']); 

    1 answer 1

    Try this

     $server = $this->transformHeadersToServerVars($headers); 

    Where $ headers is an associative array of your headers, and insert the last parameters in the call function

     $this->call($method, $uri, $params, $cookie, $files, $server);