Skip to content

Commit 0bfaaba

Browse files
authored
修复 ajax 判断异常
1 parent 45c88e7 commit 0bfaaba

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/Hander/Whoops.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ public function render($request, Throwable $e): Response
2121
}
2222

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

0 commit comments

Comments
 (0)