code: public function format($response)
      {
          if (stripos($this->contentType, 'charset') === false) {
              $this->contentType .= '; charset=' . $response->charset;
          }
          $response->getHeaders()->set('Content-Type', $this->contentType);
          if ($response->data !== null) {
              $response->content = $response->data;
          }
      }
docs: Formats the specified response.
  @param Response $response the response to be formatted.