# HttpSoft\Basis middleware
The HttpSoft\Basis package middleware classes that implements Psr\Http\Server\MiddlewareInterface.
All middleware contains only one public method Psr\Http\Server\MiddlewareInterface::process()
.
public function process(
Psr\Http\Message\ServerRequestInterface $request,
Psr\Http\Server\RequestHandlerInterface $handler
): Psr\Http\Message\ResponseInterface;
# HttpSoft\Basis\Middleware\BodyParamsMiddleware
If the Content-Type
request header is application/json
, application/*+json
, or application/x-www-form-urlencoded
, this middleware decodes the request body and makes it available from the Psr\Http\Message\ServerRequestInterface::getParsedBody()
method.
If the JSON request body cannot be decoded, the \JsonException
exception is thrown.
# HttpSoft\Basis\Middleware\ContentLengthMiddleware
Automatically sets the request header Content-Length
if it was not set earlier and the request body was defined.