Closed peterhorne closed 12 years ago
If we use pimple then we can access Elmer\Request within Elmer\Response so building up the full url for the redirect header shouldn't be a problem!
Closed as wontfix
because relative location headers are now allowed by the spec(http://trac.tools.ietf.org/wg/httpbis/trac/ticket/185) and having a redirect method will be redundant with PHP 5.4 short array syntax:
<?php
// PHP 5.4
$route->get('/', function() {
return [301, ['Location' => '/foundme']];
});
// PHP 5.3
$route->get('/', function() {
return array(301, array('Location' => '/foundme'));
});
The code is no more readable if it uses a redirect method (as a $response instance has to be instantiated):
<?php
$route->get('/', function() {
$response = new Response;
return $response->redirect(301, '/foundme');
});
Something like:
Should auto add scheme + host + script as a prefix... need to figure a way to make this information available to the response object. Ideally without having to pass in the request object as a dependency.