Skip to content

Commit

Permalink
Allow passing additional headers to multipartGraphQL Lumen test hel…
Browse files Browse the repository at this point in the history
…per too (#1395)
  • Loading branch information
spawnia committed Jun 2, 2020
1 parent 4c5670d commit f26c921
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -17,6 +17,7 @@ You can find and compare releases at the [GitHub release page](https://github.co
### Fixed

- Fix the error message when using multiple exclusive directives on a single node https://github.com/nuwave/lighthouse/pull/1387
- Allow passing additional headers to `multipartGraphQL` Lumen test helper too https://github.com/nuwave/lighthouse/pull/1395

### Deprecated

Expand Down
12 changes: 8 additions & 4 deletions src/Testing/MakesGraphQLRequestsLumen.php
Expand Up @@ -84,19 +84,23 @@ protected function postGraphQL(array $data, array $headers = []): self
*
* @param array<string, mixed> $parameters
* @param array<int, \Illuminate\Http\Testing\File> $files
* @param array<string, string> $headers Will be merged with Content-Type: multipart/form-data
* @return $this
*/
protected function multipartGraphQL(array $parameters, array $files): self
protected function multipartGraphQL(array $parameters, array $files, array $headers = []): self
{
$this->call(
'POST',
$this->graphQLEndpointUrl(),
$parameters,
[],
$files,
$this->transformHeadersToServerVars([
'Content-Type' => 'multipart/form-data',
])
$this->transformHeadersToServerVars(array_merge(
[
'Content-Type' => 'multipart/form-data',
],
$headers
))
);

return $this;
Expand Down

0 comments on commit f26c921

Please sign in to comment.