Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit70b12a8

Browse files
committed
bug#18562 [2.7][WebProfilerBunde] Give an absolute url in case the request occured from another domain (romainneutron)
This PR was merged into the 2.7 branch.Discussion----------[2.7][WebProfilerBunde] Give an absolute url in case the request occured from another domain| Q | A| ------------- | ---| Branch? | 2.7| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | n/a| License | MIT| Doc PR | n/aThis is related to#18413:Using two symfony application ProjectA and MicroServiceB, if ProjectA issues XHR to MicroServiceB and both have the WebProfilerBundle enabled, then Ajax requests will be monitored in ProjectA. But - at the moment - it will try to look for profiles under ProjectA domain whereas data are stored on MicroServiceB domain.This PR fixes this issueCommits-------1a5d4ad [WebProfilerBunde] Give an absolute url in case the request occured from another domain
2 parents1ff12d9 +1a5d4ad commit70b12a8

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

‎src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function onKernelResponse(FilterResponseEvent $event)
6565
try {
6666
$response->headers->set(
6767
'X-Debug-Token-Link',
68-
$this->urlGenerator->generate('_profiler',array('token' =>$response->headers->get('X-Debug-Token')))
68+
$this->urlGenerator->generate('_profiler',array('token' =>$response->headers->get('X-Debug-Token')), UrlGeneratorInterface::ABSOLUTE_URL)
6969
);
7070
}catch (\Exception$e) {
7171
$response->headers->set('X-Debug-Error',get_class($e).':'.$e->getMessage());

‎src/Symfony/Bundle/WebProfilerBundle/Tests/EventListener/WebDebugToolbarListenerTest.php‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
useSymfony\Component\HttpFoundation\Response;
1717
useSymfony\Component\HttpKernel\Event\FilterResponseEvent;
1818
useSymfony\Component\HttpKernel\HttpKernelInterface;
19+
useSymfony\Component\Routing\Generator\UrlGeneratorInterface;
1920

2021
class WebDebugToolbarListenerTestextends \PHPUnit_Framework_TestCase
2122
{
@@ -195,16 +196,16 @@ public function testXDebugUrlHeader()
195196
$urlGenerator
196197
->expects($this->once())
197198
->method('generate')
198-
->with('_profiler',array('token' =>'xxxxxxxx'))
199-
->will($this->returnValue('/_profiler/xxxxxxxx'))
199+
->with('_profiler',array('token' =>'xxxxxxxx'), UrlGeneratorInterface::ABSOLUTE_URL)
200+
->will($this->returnValue('http://mydomain.com/_profiler/xxxxxxxx'))
200201
;
201202

202203
$event =newFilterResponseEvent($this->getKernelMock(),$this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST,$response);
203204

204205
$listener =newWebDebugToolbarListener($this->getTwigMock(),false, WebDebugToolbarListener::ENABLED,'bottom',$urlGenerator);
205206
$listener->onKernelResponse($event);
206207

207-
$this->assertEquals('/_profiler/xxxxxxxx',$response->headers->get('X-Debug-Token-Link'));
208+
$this->assertEquals('http://mydomain.com/_profiler/xxxxxxxx',$response->headers->get('X-Debug-Token-Link'));
208209
}
209210

210211
publicfunctiontestThrowingUrlGenerator()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp