The Request::isAjax() method attempts to retrieve an HTTP header via Headers::get() by passing a header name as is formatted in $_SERVER. This does not work as Headers::all() returns the headers with keys as passed in the actual HTTP request. The primary issue being the usage of underscores (X_REQUESTED_WITH) versus hyphens/dashes (X-REQUESTED-WITH).
I took the opportunity to try and cleanup/optimize the method as well since it is so short.
Description
The
Request::isAjax()
method attempts to retrieve an HTTP header viaHeaders::get()
by passing a header name as is formatted in$_SERVER
. This does not work asHeaders::all()
returns the headers with keys as passed in the actual HTTP request. The primary issue being the usage of underscores (X_REQUESTED_WITH) versus hyphens/dashes (X-REQUESTED-WITH).I took the opportunity to try and cleanup/optimize the method as well since it is so short.
Related Issue
N/A