Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't override Accept routine #9

Closed
thiagophx opened this issue Oct 9, 2011 · 3 comments
Closed

Can't override Accept routine #9

thiagophx opened this issue Oct 9, 2011 · 3 comments

Comments

@thiagophx
Copy link
Contributor

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.

@alganet
Copy link
Member

alganet commented Oct 9, 2011

Some routines should indeed be unique inside each route. I believe you're right and I'm gonna work on this.

@alganet
Copy link
Member

alganet commented Nov 3, 2011

This has been fixed, but instead of keeping the first unique routine, the last one is always used. Most important: they don't run twice.

@alganet alganet closed this as completed Nov 3, 2011
@thiagophx
Copy link
Contributor Author

Awesome!

On Thu, Nov 3, 2011 at 6:11 PM, Alexandre Gomes Gaigalas <
reply@reply.github.com>wrote:

This has been fixed, but instead of keeping the first unique routine, the
last one is always used. Most important: they don't run twice.


Reply to this email directly or view it on GitHub:
#9 (comment)

thiagorigo.com | @thiagophx | ZCE 5.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants