Hi there
Related to #2709, how is it possible to get a decorated request?
I mean, to get a response factory that would create a decorated response, we could use \Slim\Factory\Psr17\SlimHttpPsr17Factory. But I can't use \Slim\Factory\Psr17\SlimHttpServerRequestCreator to achieve that for decorated requests, could I?
declare(strict_types=1);
use Nyholm\Psr7\Factory\Psr17Factory;
use Nyholm\Psr7Server\ServerRequestCreator;
use Psr\Http\Message\RequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
use Slim\Factory\AppFactory;
use Slim\Factory\Psr17\SlimHttpPsr17Factory;
require __DIR__.'/../vendor/autoload.php';
$responseFactory = new Psr17Factory();
$app = AppFactory::create(
SlimHttpPsr17Factory::createDecoratedResponseFactory(
$responseFactory, $responseFactory
)
);
$app->get('/', function (Request $request, Response $response, array $args) {
$response->getBody()->write(get_class($request).', '.get_class($response));
return $response;
});
// Create the nyholm server request creator.
$creator = new ServerRequestCreator(
$responseFactory, $responseFactory, $responseFactory, $responseFactory
);
// Create the request.
$request = $creator->fromGlobals();
$app->run($request);
Requesting the route would return
Nyholm\Psr7\ServerRequest, Slim\Http\Response
Hi there
Related to #2709, how is it possible to get a decorated request?
I mean, to get a response factory that would create a decorated response, we could use
\Slim\Factory\Psr17\SlimHttpPsr17Factory. But I can't use\Slim\Factory\Psr17\SlimHttpServerRequestCreatorto achieve that for decorated requests, could I?Requesting the route would return