Skip to content

Commit 7f01d36

Browse files
authored
Merge pull request #52 from codebendercc/libtest-fix
Put back HTTP header checks used in library tests
2 parents b325d59 + 97ba213 commit 7f01d36

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Diff for: Symfony/src/Codebender/CompilerBundle/Controller/DefaultController.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,24 @@ public function indexAction($authorizationKey, $version)
6363
]);
6464
}
6565

66-
$request = $this->getRequest()->getContent();
66+
$requestObject = $this->getRequest();
67+
$request = $requestObject->getContent();
6768
if ($version == 'v1') {
69+
// Custom headers used during library tests.
70+
// They don't affect the compiler's response and make our life easier.
71+
if ($requestObject->headers->get('X-Set-Exec-Time') == 'true') {
72+
ini_set('max_execution_time', '30');
73+
}
74+
$mongoProjectId = $requestObject->headers->get('X-Mongo-Id');
75+
6876
//Get the compiler service
6977
/** @var CompilerHandler $compiler */
7078
$compiler = $this->get('compiler_handler');
7179

7280
$reply = $compiler->main($request, $params);
81+
if ($mongoProjectId != '') {
82+
$reply['mongo-id'] = $mongoProjectId;
83+
}
7384

7485
return new JsonResponse($reply);
7586
}

0 commit comments

Comments
 (0)