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.

Request

Path

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

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

Response

Cookies

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.