No singleton, get every time new instance of configured HTTP response
class in `\MvcCore\Application::GetInstance()->GetResponseClass();`.
@param int		$code
@param array		$headers
@param string	$body
@return \MvcCore\Response|\MvcCore\IResponse
14331
public static function CreateInstance (
		$code = \MvcCore\IResponse::OK,
		$headers = [],
		$body = ''
	) {
		$responseClass = \MvcCore\Application::GetInstance()->GetResponseClass();
		return new $responseClass($code, $headers, $body);
	}
703163
public function respond(int $statusCode = null, array $headers = []):JsonResponse
    {
        if (! is_null($statusCode)) {
            $this->setStatus($statusCode);
        }

        $data = $this->toArray();
        $data = $this->includeStatusCode($data);
        $data = $this->includeSuccessFlag($data);

        return $this->responseFactory->json($data, $this->statusCode, $headers);
    }
769876
public function httpRequest(
        string $method, string $uri, array $headers = [], array $body = []): EsiResponse
    {

        // Include some basic headers to those already passed in. Everything
        // is considered to be Json.
        $headers = array_merge($headers, [
            'Accept'       => 'application/json',
            'Content-Type' => 'application/json',
            'User-Agent'   => 'Eseye/' . Eseye::VERSION . '/' .
                Configuration::getInstance()->http_user_agent,
        ]);

        // Add some debug logging and start measuring how long the request took.
        $this->logger->debug('Making ' . $method . ' request to ' . $uri);
        $start = microtime(true);

        // Json encode the body if it has data, else just null it
        if (count($body) > 0)
            $body = json_encode($body);
        else
            $body = null;

        try {

            // Make the _actual_ request to ESI
            $response = $this->getClient()->send(
                new Request($method, $uri, $headers, $body));

        } catch (ClientException | ServerException $e) {

            // Log the event as failed
            $this->logger->error('[http ' . $e->getResponse()->getStatusCode() . ', ' .
                strtolower($e->getResponse()->getReasonPhrase()) . '] ' .
                $method . ' -> ' . $this->stripRefreshTokenValue($uri) . ' [t/e: ' .
                number_format(microtime(true) - $start, 2) . 's/' .
                implode(' ', $e->getResponse()->getHeader('X-Esi-Error-Limit-Remain')) . ']'
            );

            // Grab the body from the StreamInterface intance.
            $responseBody = $e->getResponse()->getBody()->getContents();

            // For debugging purposes, log the response body
            $this->logger->debug('Request for ' . $method . ' -> ' . $uri . ' failed. Response body was: ' .
                $responseBody);

            // Raise the exception that should be handled by the caller
            throw new RequestFailedException($e, $this->makeEsiResponse(
                $responseBody,
                $e->getResponse()->getHeaders(),
                'now',
                $e->getResponse()->getStatusCode())
            );
        }

        // Log the successful request.
        $this->logger->log('[http ' . $response->getStatusCode() . ', ' .
            strtolower($response->getReasonPhrase()) . '] ' .
            $method . ' -> ' . $this->stripRefreshTokenValue($uri) . ' [t/e: ' .
            number_format(microtime(true) - $start, 2) . 's/' .
            implode(' ', $response->getHeader('X-Esi-Error-Limit-Remain')) . ']'
        );

        // Return a container response that can be parsed.
        return $this->makeEsiResponse(
            $response->getBody()->getContents(),
            $response->getHeaders(),
            $response->hasHeader('Expires') ? $response->getHeader('Expires')[0] : 'now',
            $response->getStatusCode()
        );
    }
6575
public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface
    {
        $response = new Response('php://memory', $code, []);
        $response = $response->withStatus($code, $reasonPhrase);

        foreach ($this->config->baseHeaders() as $header => $value) {
            $response = $response->withAddedHeader($header, $value);
        }

        return $response;
    }
119213
protected function createRedirectResponse($url, $code = 301)
    {
        $response = $this->getComponentResponseFactory()
            ->createComponentResponse();

        $response->setCode($code)
                 ->getHeaders()
                    ->setHeader('Location', $url);

        return $response;
    }
525238
protected function respond($data, $code, array $headers = [])
    {
        return new JsonResponse($data, $code, array_merge($this->defaultHeaders(), $headers));
    }
737749
public function getAccessTokenResponse($code)
    {
        $postKey = (version_compare(ClientInterface::VERSION, '6') === 1) ? 'form_params' : 'body';

        $response = $this->getHttpClient()->post($this->getTokenUrl(), [
            'headers' => ['Accept' => 'application/json'],
            $postKey => $this->getTokenFields($code),
        ]);

        return json_decode($response->getBody(), true);
    }
823971
static public function sendHeader( $code, $protocol = "HTTP/1.0" ){
		$text = self::getText( $code );
		header( $protocol.' '.$code.' '.$text );
	}
692845
protected function responseError($body, $httpCode)
    {
        return $this->parseResponse($body) ?: $this->jsonError($body, $httpCode);
    }
572861
public function api($code, $msg = '', $data = '', $header = [], $options = [])
    {
        $this->json([
            'code' => $code,
            'msg' => $msg,
            'data' => $data
        ], $header, $options);
    }
680560
public function setHttpCode($code)
    {
        $this->addHeader(new Header\Header('HTTP/1.1 ' . (int) $code . ' ' . Header\HttpCode::getText($code), true, (int) $code));

        return $this;
    }
844640
protected function createResponse(int $code, \stdClass $definition)
    {
        return new Response(
            $code,
            $this->schemaFactory->create(isset($definition->schema) ? $definition->schema : null)
        );
    }
52198
public static function start_header(
		int $code=200, int $cache=0, array $headers=[]
	) {
		$msg = 'OK';
		extract(self::get_header_string($code));

		$proto = isset($_SERVER['SERVER_PROTOCOL'])
			? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1';
		static::header("$proto $code $msg");
		if ($cache) {
			$cache = intval($cache);
			$expire = time() + $cache;
			static::header("Expires: " .
				gmdate("D, d M Y H:i:s", $expire)." GMT");
			static::header("Cache-Control: must-revalidate");
		} else {
			static::header("Expires: Mon, 27 Jul 1996 07:00:00 GMT");
			static::header(
				"Cache-Control: no-store, no-cache, must-revalidate");
			static::header("Cache-Control: post-check=0, pre-check=0");
			static::header("Pragma: no-cache");
		}
		static::header("Last-Modified: " .
			gmdate("D, d M Y H:i:s")." GMT");
		static::header("X-Powered-By: Zap!", true);

		if (!$headers)
			return;
		foreach ($headers as $header)
			static::header($header);
	}
1152249
public function send($code, $body = '')
    {
        if (!isset($this->codes[$code])) {
            $statusCode = 500;
            $body = 'API attempted to return an unknown HTTP status.';
        }
        // if the body wasn't defined, default to the inbuilt response
        if (!$body) $body = $this->codes[$code];
        header('HTTP/1.1 ' . $code . ' ' . $this->codes[$code]);
        header('Content-type: application/json');
        echo json_encode($body);
        exit;
    }
154856
protected function instance(string $body, int $status = 200, array $headers = []) : Response
    {
        $response = new Response('php://memory', $status, $headers);
        $response->getBody()->write($body);

        return $response;
    }
512955
public function response($body, $headerArray = array(), $statusCode = 200, $reasonPhrase = null)
    {
        $headers = $this->builder->editableHeaders($headerArray);
        return $this->buildResponse($headers, $body, $statusCode, $reasonPhrase);
    }
234131
protected function respond($data, $code, array $headers = [])
    {
        return response()->json($data, $code, array_merge($this->defaultHeaders(), $headers));
    }