Skip to content

Commit 6e46095

Browse files
committed
fixed bug
1 parent 54c6282 commit 6e46095

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/IdempotentMiddleware.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@ public function handle(Request $request, Closure $next)
4343
*/
4444
public function terminate($request, $response)
4545
{
46-
Cache::forget($this->getCacheKey($request->header($this->config['header_name'])));
46+
// 修复在其他中间件出现异常,config 获取不到报错的问题
47+
if (! $this->config || ! $request->header($this->config['header_name'] ?? '')) {
48+
return;
49+
}
50+
51+
Cache::forget($this->getCacheKey($request->header($this->config['header_name'] ?? '')));
4752
}
4853

4954
/**

0 commit comments

Comments
 (0)