Skip to content

Manipulate (e.g. sanitize) incoming request parameter before deserialize-operation #134

Answered by maikschneider
Moongazer asked this question in Q&A
Discussion options

You must be logged in to vote

t3api uses PSR-15 middleware to generate the output. You could create your own middleware to modify the query parameter for your endpoint. Try something like this:

<?php

namespace Vendor\YourExtension\Middleware;

use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use SourceBroker\T3api\Service\RouteService;

class ApiManipulation implements MiddlewareInterface
{
    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        // check for t3api requests
        if (!RouteService::routeHasT3ApiResourceEnhanc…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kszymukowicz
Comment options

Answer selected by kszymukowicz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants