ikkez/f3-middleware

BODY not available in middleware

Closed this issue · 2 comments

Hi,

The $f3->BODY isn't available in the middleware, but in the following route.

Here's my code:

$mw->on("foo", "POST|PUT *", function (\Base $f3) {
    echo var_dump($f3->get("BODY")); //null
    return true;
});

if(!$mw->run("foo")){
    return;
}
$f3->run();

edit: If I try to access $f3->BODY in the beforeRoute() method, it's there. But not in the middleware handler.

ikkez commented

Fix committed.

Thanks for the super quick fix! But is it possible that the f3->run() just extracts the BODY again and overwrites the field? I tried to transform the BODY via middleware and replace the BODY field.

If so, I'll just set a new variable.

edit: Forget what I wrote. Layer 8 error. It's there.