Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix include when provided in array format from request #52

Merged
merged 1 commit into from
Jul 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
}
}