Skip to content

Commit 8d0382e

Browse files
committed
兼容postman
1 parent 0a3dc71 commit 8d0382e

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/Hander/Whoops.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ public function render($request, Throwable $e): Response
3333

3434
$this->runner->pushHandler(new PrettyPageHandler());
3535

36-
// 兼容 Cors请求
37-
if ($request->isAjax() || (isset($_SERVER['HTTP_SEC_FETCH_MODE']) && $_SERVER['HTTP_SEC_FETCH_MODE'] === 'cors')) {
36+
// 兼容 Cors Postman 请求
37+
if ($request->isAjax() ||
38+
false !== strpos($_SERVER['HTTP_USER_AGENT'], 'Postman') ||
39+
(isset($_SERVER['HTTP_SEC_FETCH_MODE']) && $_SERVER['HTTP_SEC_FETCH_MODE'] === 'cors')) {
3840
$this->runner->pushHandler(new JsonResponseHandler());
3941
}
4042

0 commit comments

Comments
 (0)