code: public static function doesResponseHaveBody($request, $response)
      {
          if ('HEAD' === strtoupper($request->getMethod())) {
              return false;
          }
  
          $status = $response->getStatusCode();
  
          if ((100 <= $status && 200 > $status) || 204 === $status || 304 === $status) {
              return false;
          }
  
          if (self::hasHeader($response, 'Transfer-Encoding')) {
              return true;
          };
  
          if (!$contentLength = self::getHeader($response, 'Content-Length')) {
              return false;
          }
  
          return 0 < $contentLength[0];
      }
docs: Does the HTTP response contain body content?
  
  "For response messages, whether or not a message-body is included with a message is dependent
  on both the request method and the response status code (section 6.1.1). All responses to the
  HEAD request method MUST NOT include a message-body, even though the presence of entity-header
  fields might lead one to believe they do. All 1xx (informational), 204 (no content), and 304
  (not modified) responses MUST NOT include a message-body. All other responses do include a
  message-body, although it MAY be of zero length."
  https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.3
  
  @param RequestInterface|SymfonyRequest $request
  @param ResponseInterface|SymfonyResponse $response
  @return bool