Skip to content

Commit bc80630

Browse files
authored
fix: isAjax header correction (#15)
Correct the header name format to determine if the request is an ajax one
1 parent 77eebb3 commit bc80630

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/Request.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,7 @@ public static function hasHeader(string $header): bool
6767
*/
6868
public static function isAjax(): bool
6969
{
70-
if (static::params('isajax')) {
71-
return true;
72-
}
73-
74-
if (Headers::get('X_REQUESTED_WITH') && Headers::get('X_REQUESTED_WITH') === 'XMLHttpRequest') {
75-
return true;
76-
}
77-
78-
return false;
70+
return !!static::params('isajax') || Headers::get('X-Requested-With') === 'XMLHttpRequest';
7971
}
8072

8173
/**

0 commit comments

Comments
 (0)