Given the URL `http://media.jonnys-place.app/img/logo.svg` I want to grab "logo" and "svg" I'm using Aura.Router for the routing and Zend Diactoros to serve the request/response. However the following code isn't working for me:
$map->
get('media.img', '/img/{file}{format}', function (ServerRequestInterface $request, ResponseInterface $response) use ( $mediaController )
{
$file = $request->getAttribute("file");
$format = $request->getAttribute("format");
$response->getBody()->write("You asked for file '{$file}' of format '{$format}'");
return $response;
})->
host("media.jonnys-place.{tld}")->
tokens([
'file' => '\w+',
'format' => '(\.[^/]+)?',
])
;
Result is You asked for file '' of format '' Even using $request->getAttributes() returns an empty array. I'm sure I'm following the instructions correctly.
What's going on?
Did you defined the withAttribute to set the attributes to request ?Thank youHari KT