Skip to content

Commit

Permalink
Fix include when provided in array (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
maximebeaudoin committed Jul 25, 2019
1 parent a0a803a commit 4e0a4e1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "0.16-dev"
"dev-master": "0.17-dev"
}
},
"scripts": {
Expand Down
10 changes: 9 additions & 1 deletion src/Laravel/ResponseServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,16 @@ protected function bootResponse()
// Custom serializer because DataArraySerializer doesn't provide the opportunity to change the resource key
$manager->setSerializer($this->getSerializer());

//Get includes from request
$includes = $this->app['Illuminate\Http\Request']->get('include');

//If includes is not already a array
if(!is_array($includes)){
$includes = explode(',', $includes);
}

// Are we going to try and include embedded data?
$manager->parseIncludes(explode(',', $this->app['Illuminate\Http\Request']->get('include')));
$manager->parseIncludes($includes);

// Return the Response object
$response = new Response($manager);
Expand Down
12 changes: 12 additions & 0 deletions tests/Laravel/ResponseFactoryFake.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,16 @@ public function noContent($status = 204, array $headers = [])
{
// TODO: Implement noContent() method.
}

/**
* Return the raw contents of a binary file.
*
* @param \SplFileInfo|string $file
* @param array $headers
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
*/
public function file($file, array $headers = [])
{
// TODO: Implement file() method.
}
}

0 comments on commit 4e0a4e1

Please sign in to comment.