]> source.dussan.org Git - nextcloud-server.git/commit
Add functions to modify cookies to response class
authorLukas Reschke <lukas@owncloud.com>
Thu, 27 Nov 2014 13:19:00 +0000 (14:19 +0100)
committerLukas Reschke <lukas@owncloud.com>
Thu, 27 Nov 2014 13:19:00 +0000 (14:19 +0100)
commit048139074df674d0ac82da12357d3934af3abc2e
tree04e66fdbdc9fbb255036e36fe29b2274b3661af6
parente306b588d29d71bf547b19d1725ea9ad1a5fbf42
Add functions to modify cookies to response class

Currently there is no AppFramework way to modify cookies, which makes it unusable for quite some use-cases or results in untestable code.

This PR adds some basic functionalities to add and invalidate cookies.

Usage:
```php
$response = new TemplateResponse(...);
$response->addCookie('foo', 'bar');
$response->invalidateCookie('foo');
$response->addCookie('bar', 'foo', new \DateTime('2015-01-01 00:00'));
```

Existing cookies can be accessed with the AppFramework using `$this->request->getCookie($name)`.
lib/private/appframework/app.php
lib/private/appframework/http/dispatcher.php
lib/public/appframework/http/response.php
tests/lib/appframework/AppTest.php
tests/lib/appframework/http/DispatcherTest.php
tests/lib/appframework/http/ResponseTest.php