/** * @param string $content * @param int $status * @param array $headers * @return Response */ function response_json($content, $status = Response::HTTP_OK, array $headers = []) { // We have to do a little trick and do not allow WHMCS to sent all it's content. $response = new JsonResponse($content, $status, $headers); $response->sendHeaders(); die($response->getContent()); }
/** * {@inheritDoc} */ public function sendHeaders() { if ($this->isJSONP()) { $contentType = 'text/html; charset=utf-8'; } else { $contentType = 'application/json; charset=utf-8'; } $this->headers->add(['X-Drupal-Ajax-Token' => '1', 'Content-Type' => $contentType]); parent::sendHeaders(); return $this; }