Build an empty response

@param  array   $headers
@param  integer $options
@return JsonResponse
189189
protected function buildEmptyResponse($headers = [], $options = 0)
    {
        $headers = array_merge($headers, $this->headers);

        $statusCode = $this->statusCode ? 
            $this->statusCode : 
            204;

        $response = new JsonResponse([], $statusCode, $headers, $options);

        return $response;
    }
1144465
private static function request($options = array()) {
    $body = "";
    $headers = array(
      "Accept: application/json",
      "User-Agent: ".self::$userAgentName."/".Api::getVersion()
    );
    $method = "GET";

    if (!empty($options["method"])) {
      $method = $options["method"];
    }

    if (!empty($options["body"])) {
      array_push($headers, "Content-Type: application/json");
      $body = json_encode($options["body"]);
      array_push($headers, "Content-Length: ".strlen($body));
    }

    $sign = false;
    if (!empty($options["sign"])) {
      $sign = $options["sign"];
    }

    if ($sign) {
      $signResult = self::signRequest(array(
        "body" => $body,
        "method" => $method,
        "path" => $options["path"]
      ));
      $headers = array_merge($headers, $signResult["headers"]);
    }

    $curlResult = self::curl(array(
      "url" => Api::getAuthservicesUrl().$options["path"],
      "method" => $method,
      "body" => $body,
      "headers" => $headers
    ));

    if (!empty($curlResult["errorCode"]) && !empty($curlResult["errorMessage"])) {
      throw new \Exception($curlResult["errorMessage"], $curlResult["errorCode"]);
    }

    $isResponseOk = true;
    if ($curlResult["status"] < 200 || $curlResult["status"] > 299) {
      $isResponseOk = false;
    }

    $responseData = json_decode($curlResult["body"]);

    if (!$isResponseOk) {
      if (!empty($responseData->message) && !empty($responseData->code) && !empty($responseData->wlt)) {
        throw new \Exception($responseData->message.", request id: ".$responseData->wlt, $responseData->code);
      } else {
        throw new \Exception("HTTP status is not 2xx");
      }
    }

    return $responseData;
  }
1114741
public function getOnTheAir(array $options = [], array $headers = [])
    {
        return $this->getFactory()->createResultCollection(
            $this->getApi()->getOnTheAir($options, $headers)
        );
    }
1088227
public function head($url, $headers = [], $options = [])
    {
        return $this->createRequestShortcut('HEAD', $url, null, $headers, $options);
    }
571228
public function makeRequest($url, $options = [], $parseResponse = true)
    {
        $headers = isset($options['headers']) ? $options['headers'] : [];
        $options['headers'] = array_merge($this->getExtraApiHeaders(), $headers);

        return parent::makeRequest($url, $options, $parseResponse);
    }
234118
public function resourceJson($data = array(), $status = 200, array $headers = array())
  {
    $headers = array_merge($headers, $this->getRequestLimitHeader());
    $headers = array_merge($headers, $this->getConfig('headers'));

    return $this->getResponse()->resourceJson($data, $status, $headers);
  }
372774
public function respond($response, $status, $headers, $options)
    {
        switch ($this->getRequestFormat()) {
            case 'html' :
            case 'text/html' :
                return Response::make($response, $status, $headers, $options)
                    ->header('Content-Type', 'text/html');
            default :
                // whether 'Content-Type' is NULL or equal to anything such as 'application/json' response will be JSON
                return Response::json($response, $status, $headers, $options);
        }
    }
240304
public function json($data = [], $status = 200, array $headers = [], $options = 0)
    {
        return new JsonResponse($data, $status, $headers, $options);
    }
177673
private function normalizeRequestHeaders(array $headers)
    {
        // Explicitly set an empty Expect header, so that the server will not
        // respond with a "100 Continue" status code for large uploads.
        $emptyExpectHeader = 'Expect: ';
        $haveExpectHeader = false;

        for ($i = 0; $i < count($headers); $i++) {
            if ($this->isExpectHeader($headers[$i])) {
                // There is already an expect header - let's set it to empty
                $headers[$i] = $emptyExpectHeader;
                $haveExpectHeader = true;
                break;
            }
        }

        if (!$haveExpectHeader) {
            // There is no expect header - let's add one
            $headers[] = $emptyExpectHeader;
        }

        return $headers;
    }
677841
protected function buildHeaders(\Zend_Controller_Response_Abstract $response, array $headers)
    {
        foreach ($headers as $header => $value) {
            if (!in_array($header, $this->defaultHeaders)) {
                $response->setHeader($header, $value);
            }
        }

        return $this;
    }
802132
public function getPopular(array $options = [], array $headers = [])
    {
        return $this->getFactory()->createResultCollection(
            $this->getApi()->getPopular($options, $headers)
        );
    }
237963
protected function response($data, $statusCode = 200, array $headers = [])
    {
        if ($data instanceof Arrayable && !$data instanceof JsonSerializable) {
            $data = $data->toArray();
        }

        return new JsonResponse($data, $statusCode, $headers);
    }
156459
public static function toArray($headers, $options = [])
    {
        $data = [];
        foreach ($headers as $name => $header) {
            if (strtolower($name) === 'set-cookie') {
                foreach ($header->data() as $value) {
                    $data[] = $name . ': ' . $value;
                }
            } else {
                $data[] = $name . ': ' . $header->value();
            }
        }
        return $data;
    }
277670
public function options($uri,array $headers,$body)
        {
            return $this->prepareRequest(self::OPTIONS,$uri,$headers,$body);
        }
984981
public static function responseJson($mdata = array(), $status = null, $msg = '', array $headers = array(), $options = 0)
    {
        $response = self::response($mdata, $status, $msg);
        return Response::json($response, $response['status'], $headers, $options);
    }
1003624
public static function post($url, $headers = array(), $data = array(), $options = array()) {
		return self::request($url, $headers, $data, self::POST, $options);
	}
240303
public function get($url, $headers = [], $options = [])
    {
        return $this->request('GET', $url, null, $headers, $options);
    }