Skip to content

Commit aec6cbf

Browse files
committed
Merge branch 'ryanolee-fix/UpErrorVerbocity' into 1.4
2 parents c60c5e9 + f53284c commit aec6cbf

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Changelog
22
=========
33

4+
1.4.6
5+
-----
6+
7+
* [Symfony HttpCache] Added a neutral "Bad Request" body to user hash mismatch
8+
response to have something searchable in the code when debugging.
9+
410
1.4.5
511
-----
612

src/SymfonyCache/UserContextSubscriber.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public function preHandle(CacheEvent $event)
117117
if ($request->headers->get('accept') === $this->options['user_hash_accept_header']
118118
|| null !== $request->headers->get($this->options['user_hash_header'])
119119
) {
120-
$event->setResponse(new Response('', 400));
120+
$event->setResponse(new Response('Bad Request', 400));
121121

122122
return;
123123
}

tests/Unit/SymfonyCache/UserContextSubscriberTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public function testGenerateUserHashNotAllowed($arg, $options)
7575

7676
$this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Response', $response);
7777
$this->assertSame(400, $response->getStatusCode());
78+
$this->assertSame('Bad Request', $response->getContent());
7879
}
7980

8081
/**
@@ -93,6 +94,7 @@ public function testPassingUserHashNotAllowed($arg, $options)
9394

9495
$this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Response', $response);
9596
$this->assertSame(400, $response->getStatusCode());
97+
$this->assertSame('Bad Request', $response->getContent());
9698
}
9799

98100
/**

0 commit comments

Comments
 (0)