Skip to content

Commit

Permalink
Fix middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
mtvbrianking committed Jul 4, 2018
1 parent 9ac66ad commit e6f5df9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
{
"name": "Brian Matovu",
"email": "[email protected]",
"homepage": "https://bmatovu.com",
"homepage": "http://bmatovu.com",
"role": "Developer"
}
],
Expand Down
6 changes: 4 additions & 2 deletions src/Http/Middleware/RequireXml.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@ class RequireXml
/**
* Handle an incoming request.
*
* @link https://stackoverflow.com/a/11973933/2732184
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
{
if ($request->header('Accept') != 'text/xml') {
return response()->xml(['error' => 'Only accepting text/xml'], 406);
if ($request->getContentType() != 'xml') {
return response()->xml(['error' => 'Only accepting xml content'], 415);
}

return $next($request);
Expand Down

0 comments on commit e6f5df9

Please sign in to comment.