code: public function handle($request, \Closure $next, string $default = null)
      {
          $api = $this->container->make(Api::class);
          /** @var HeaderParametersInterface $headers */
          $headers = $this->container->make(HeaderParametersInterface::class);
          $contentType = $headers->getContentTypeHeader();
  
          $codec = $this->factory->createCodec(
              $api->getContainer(),
              $this->matchEncoding($api, $request, $headers->getAcceptHeader(), $default),
              $decoder = $contentType ? $this->matchDecoder($api, $request, $contentType, $default) : null
          );
  
          $this->matched($codec);
  
          if (!$contentType && $this->isExpectingContent($request)) {
              throw new DocumentRequiredException();
          }
  
          return $next($request);
      }
docs: Handle the request.
  
  @param Request $request
  @param \Closure $next
  @param string|null $default
  the default negotiator to use if there is not one for the resource type.
  @return mixed
  @throws HttpException