diff options
author | Daniel Kesselberg <mail@danielkesselberg.de> | 2020-03-01 00:42:24 +0100 |
---|---|---|
committer | Daniel Kesselberg <mail@danielkesselberg.de> | 2020-03-01 00:42:24 +0100 |
commit | 68148f4073948a39e7247c3e9b5e6a4317d25fd0 (patch) | |
tree | f03b14a5e96921c0ec1ab5118a0a5763a948f8e9 /tests | |
parent | 72cc8270cdd0f1c95ef1708be81cf4ac424dca47 (diff) | |
download | nextcloud-server-68148f4073948a39e7247c3e9b5e6a4317d25fd0.tar.gz nextcloud-server-68148f4073948a39e7247c3e9b5e6a4317d25fd0.zip |
Always use status 200 for avatar response
As discussed in #18603 caching a 201 response is hard. It's now possible to distinguish between generated and uploaded avatars by reading the X-NC-IsCustomAvatar (0 = generated, 1 = uploaded) header.
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Core/Controller/AvatarControllerTest.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/Core/Controller/AvatarControllerTest.php b/tests/Core/Controller/AvatarControllerTest.php index 284c82310a1..5c66c06a2c5 100644 --- a/tests/Core/Controller/AvatarControllerTest.php +++ b/tests/Core/Controller/AvatarControllerTest.php @@ -193,6 +193,8 @@ class AvatarControllerTest extends \Test\TestCase { $this->assertEquals(Http::STATUS_OK, $response->getStatus()); $this->assertArrayHasKey('Content-Type', $response->getHeaders()); $this->assertEquals('image type', $response->getHeaders()['Content-Type']); + $this->assertArrayHasKey('X-NC-IsCustomAvatar', $response->getHeaders()); + $this->assertEquals('1', $response->getHeaders()['X-NC-IsCustomAvatar']); $this->assertEquals('my etag', $response->getETag()); } @@ -206,9 +208,11 @@ class AvatarControllerTest extends \Test\TestCase { $response = $this->avatarController->getAvatar('userId', 32); - $this->assertEquals(Http::STATUS_CREATED, $response->getStatus()); + $this->assertEquals(Http::STATUS_OK, $response->getStatus()); $this->assertArrayHasKey('Content-Type', $response->getHeaders()); $this->assertEquals('image type', $response->getHeaders()['Content-Type']); + $this->assertArrayHasKey('X-NC-IsCustomAvatar', $response->getHeaders()); + $this->assertEquals('0', $response->getHeaders()['X-NC-IsCustomAvatar']); $this->assertEquals('my etag', $response->getETag()); } |