Respect/Rest — Issue #9: Can't override Accept routine
Author: thiagophx
Created: 2011-10-09 15:46:34+00:00
State: open

If I have something like that

public function testAccept()
{
$this->object->always('Accept', array('application/json' => function($data) {
return 'ha';
}));
$request = new Request('get', '/users/alganet');
$_SERVER['HTTP_ACCEPT'] = 'application/json';
$this->object->get('/users/*', function() {
return range(0, 10);
})->accept(array('application/json' => function ($d)
{
var_dump($d);
}));
$r = $this->object->dispatchRequest($request)->response();
$this->assertEquals(json_encode(range(0, 10)), $r);
}

The always accept is execute before the accept of the route.
In my opinion, olny the route accept shloud be run, not both.