Update applications

This commit is contained in:
Romain Neutron
2012-09-28 11:07:14 +02:00
parent c220bcf9df
commit 49b9581e91
3 changed files with 16 additions and 9 deletions

View File

@@ -1,5 +1,14 @@
<?php <?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2012 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea; namespace Alchemy\Phrasea;
use Alchemy\Phrasea\PhraseanetServiceProvider; use Alchemy\Phrasea\PhraseanetServiceProvider;
@@ -408,4 +417,3 @@ class Application extends SilexApplication
return static::$availableLanguages; return static::$availableLanguages;
} }
} }

View File

@@ -11,7 +11,7 @@
namespace Alchemy\Phrasea\Application; namespace Alchemy\Phrasea\Application;
use Alchemy\Phrasea\BaseApplication; use Alchemy\Phrasea\Application as PhraseaApplication;
use Silex\Application as SilexApplication; use Silex\Application as SilexApplication;
use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -21,7 +21,8 @@ use Symfony\Component\HttpFoundation\Request;
return call_user_func(function($environment = 'prod') { return call_user_func(function($environment = 'prod') {
$app = new BaseApplication($environment); $app = new PhraseaApplication($environment);
/** /**
* disable session * disable session
*/ */
@@ -693,6 +694,7 @@ return call_user_func(function($environment = 'prod') {
$result = $app['api']->get_error_message($app['request'], $code, $e->getMessage()); $result = $app['api']->get_error_message($app['request'], $code, $e->getMessage());
$response = $result->get_response(); $response = $result->get_response();
$response->headers->set('X-Status-Code', $result->get_http_code());
foreach ($headers as $key => $value) { foreach ($headers as $key => $value) {
$response->headers->set($key, $value); $response->headers->set($key, $value);

View File

@@ -361,12 +361,9 @@ class API_V1_result
public function get_response() public function get_response()
{ {
$response = new Response( $response = new Response(
$this->format() $this->format(),
, $this->get_http_code() $this->get_http_code(),
, array( array('Content-Type' => $this->get_content_type())
'Content-Type' => $this->get_content_type(),
'X-Status-Code'=> $this->get_http_code(),
)
); );
$response->setCharset('UTF-8'); $response->setCharset('UTF-8');