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

During testing of Middleware the Request is not decorated with the routing parameters #19

Open
HenkPoley opened this issue Jan 8, 2020 · 0 comments

Comments

@HenkPoley
Copy link
Contributor

HenkPoley commented Jan 8, 2020

Normally Lumen decorates the Request with the routing parameters.

E.g. in routes/web.php:

$router->group(['prefix' => '/{prefixId:[0-9]+}'], function () use ($router) {
    $router->get('/something/{somethingId:[0-9]+}', 'SomethingController@show');
}

You would be able to attach a middleware to the group() or the get(), and access $request->prefixId or $request->somethingId.

public function handle(Request $request, Closure $next)
{
    if(42 === (int) $request->prefixId) return null;
    if(1 === (int) $request->somethingId) return null;

    return $next($request);
}

This does not work under lumen-testing.

(I guess this is related to Issue #18)

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

1 participant