Skip to content

Commit

Permalink
修复 ajax 判断异常
Browse files Browse the repository at this point in the history
  • Loading branch information
edenleung authored Dec 6, 2019
1 parent 45c88e7 commit 0bfaaba
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Hander/Whoops.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ public function render($request, Throwable $e): Response
}

// 兼容 Cors Postman 请求
if ($request->isAjax() || false !== strpos($_SERVER['HTTP_USER_AGENT'], 'Postman') || (isset($_SERVER['HTTP_SEC_FETCH_MODE']) && $_SERVER['HTTP_SEC_FETCH_MODE'] === 'cors')) {
// $request->isAjax() 判断不太正常
if ($request->isJson() || false !== strpos($_SERVER['HTTP_USER_AGENT'], 'Postman') || (isset($_SERVER['HTTP_SEC_FETCH_MODE']) && $_SERVER['HTTP_SEC_FETCH_MODE'] === 'cors')) {
return $this->handleAjaxException($e);
} else {
$this->app->whoops->pushHandler(new PrettyPageHandler());
Expand Down

0 comments on commit 0bfaaba

Please sign in to comment.