Refactor middleware

This commit is contained in:
Graham Campbell
2015-12-24 16:52:56 +00:00
parent fa235857b7
commit 445f5c662a
12 changed files with 47 additions and 47 deletions

View File

@@ -21,13 +21,13 @@ class Acceptable
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string $type
* @param string|null $type
*
* @return mixed
*/
public function handle($request, Closure $next, $type)
public function handle($request, Closure $next, $type = null)
{
if (!$request->accepts($type)) {
if (!$request->accepts($type ?: 'accept:application/json')) {
throw new NotAcceptableHttpException();
}