leafsphp / http

📡 Leaf Http module
https://leafphp.dev/modules/http/
7 stars 9 forks source link

fix: isAjax header correction #15

Closed kczx3 closed 1 year ago

kczx3 commented 1 year ago

Description

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.

Related Issue

N/A

mychidarko commented 1 year ago

How did I miss this 😢 Thanks for the fix @kczx3