Skip to content

Request & Response

Kripth edited this page Jan 10, 2019 · 2 revisions

Request and Response are similar objects that contains informations about the HTTP request/response. They are aliases for lighttp's ServerRequest and ServerResponse.

They both contain headers, which can be read (case-insensitive) by treating the property headers as an associative array, and a body, which is a simple string.



It is possible to get the path of the request using the url.path property and the query parameters using the url.queryParams property.


Cookies are lazily initialized by calling the property cookies, that returns an associative array.



Cookies are added by calling the add function and passing an instance of Cookie as the first parameter. It is possible to add multiple cookies.

You can’t perform that action at this time.