mecha-cms / mecha

Minimalist content management system.

Home Page:https://mecha-cms.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prioritize Request Headers

taufik-nurrohman opened this issue · comments

The Lot::get() method currently mixes both request and response headers from the current page. Since $_SERVER['HTTP_*'] variables comes from the client, then it would be more appropriate to use Lot::get() method to retrieve request headers only:

if (Lot::get('x-moz')) {}

We can retrieve response headers using the Lot::set() method without value:

// Set the `content-type` value to `text/plain`
Lot::set('content-type', 'text/plain');

// Get the `content-type` value that has been set
echo Lot::set('content-type'); // `text/plain`

See: https://irregular-verbs.app/set