code: public function isJsonApi($request, Exception $e)
      {
          if (Helpers::wantsJsonApi($request)) {
              return true;
          }
  
          /** @var Route $route */
          $route = app(JsonApiService::class)->currentRoute();
  
          return $route->hasCodec() && $route->getCodec()->willEncode();
      }
docs: Does the HTTP request require a JSON API error response?
  
  This method determines if we need to render a JSON API error response
  for the client. We need to do this if the client has requested JSON
  API via its Accept header.
  
  @param Request $request
  @param Exception $e
  @return bool