if this is a virtual request, change the hash if set.

@param string $url
@param int $code

@return HTTPResponse
777555
public function redirect($url, $code = 302)
    {
        if ($this->data()->virtualOwner) {
            $parts = explode('#', $url);
            if (isset($parts[1])) {
                $url = $parts[0] . '#' . $this->data()->virtualOwner->ID;
            }
        }

        return parent::redirect($url, $code);
    }
106290
public function checkURL($url, $code = 302)
    {
        $components = parse_url($url);
        $request = parse_url($_SERVER['REQUEST_URI']);

        if ($components['path'] != $request['path']) {
            $redirect = $url . ($request['query'] ? '?' . $request['query'] : '');

            header("Location: " . $redirect, true, $code);
            exit();
        }
    }
933534
public function & SetCode ($code, $codeMessage = NULL) {
		/** @var $this \MvcCore\Response */
		$this->code = $code;
		if ($codeMessage !== NULL) $this->codeMessage = $codeMessage;
		http_response_code($code);
		return $this;
	}
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;
    }
717662
public function requestAndSetAccess(string $code)
    {
        $access = $this->requestAccess($code);

        // Set the access token
        $this->setAccessToken($access->access_token);

        if (property_exists($access, 'associated_user')) {
            // Set the user if applicable
            $this->setUser($access->associated_user);
        }
    }
1183548
public function redirect($uri, int $code = 302): ResponseInterface
    {
        if (!is_string($uri) && !$uri instanceof UriInterface) {
            throw new ResponseException("Redirect allowed only for string or UriInterface uris");
        }

        return $this->responseFactory->createResponse($code)->withHeader("Location", (string)$uri);
    }
465815
public function redirect($uri = '', $code = 302)
    {
        Base::getLog()->debug(__METHOD__ . ' redirect from controller', [
            'uri'  => $uri,
            'code' => $code,
        ]);
        Base::getHttp()->redirect((string) $uri, $code);
    }
495332
public function requestToken($code)
    {
        $parameters = [
            'client_id' => config('twitch-api.client_id'),
            'client_secret' => config('twitch-api.client_secret'),
            'redirect_uri' => config('twitch-api.redirect_url'),
            'code' => $code,
            'grant_type' => 'authorization_code'
        ];

        try {
            $client = new Client();

            $response = $client->post(config('twitch-api.api_url') . '/kraken/oauth2/token', ['body' => $parameters]);

            $response = $response->json();

            if (isset($response[ 'access_token' ])) {

                return $response[ 'access_token' ];
            }

        } catch (\Exception $e) {

            throw $e;
        }
    }
485373
function success(int $code, string $body=''): \Nofuzz\Http\HTTPResponse
  {
    $this->setStatusCode($code);
    $this->setBody($body);

    return $this;
  }
1081260
public function redirect($url, $code = 303)
    {
        $this->respondWith($code);
        $this->setResponseHeader('Location', $url);
        
        $urlHtml = htmlentities($url);
        $this->output('You are being redirected to <a href="' . $urlHtml . '">' . $urlHtml . '</a>', 'text/html');
    }
255990
protected function createErrorResponse($code)
    {
        $response = new HTTPResponse('', $code);

        // Show message in dev
        if (!Director::isLive()) {
            $response->setBody($response->getStatusDescription());
        }

        return $response;
    }
840047
public static function url($url, $code = 302, $headers = array())
    {
        $r = static::createRedirectResponse((string) $url, $code, $headers);

        return $r;
    }
680560
public function setHttpCode($code)
    {
        $this->addHeader(new Header\Header('HTTP/1.1 ' . (int) $code . ' ' . Header\HttpCode::getText($code), true, (int) $code));

        return $this;
    }
820699
public function header( $code = 200 ) {

		if ( ! is_array( $code ) ) {
			$code = array( $code );
		}

		self::$header = array();

		foreach ( $code as $value ) {

			if ( is_int( $value ) ) {
				self::$header[] = $_SERVER["SERVER_PROTOCOL"] . ' ' . Route::$HttpResponse[ $value ];
			} else {
				self::$header[] = $value;
			}

		}

	}
754726
public function setHttpCode(int $code): Response
    {
        if ($this->response_finished) {
            return $this;

        }

        $this->response_code = $code;

        return $this;
    }
906439
public function return(?int $code = null, ?string $path = null)
  {
    $info = ((isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '/') === '/' ? '' : $_SERVER['PATH_INFO']);

    if ($info !== '') $path = '?url=' . $info;

    if (count($_GET) > 0) {
      $path .= '&' . $_SERVER['QUERY_STRING'];
    }

    $this->url .= $path;

    if ($code !== null) {
      $this->code = $code;
      return $this->send();
    }

    return $this;
  }
616564
public function setHttpResponseCode($code)
        {
            if (!is_int($code) || (100 > $code) || (599 < $code)) {
                throw new Exception('Invalid HTTP response code');
            }

            if ((300 <= $code) && (307 >= $code)) {
                $this->_isRedirect = true;
            } else {
                $this->_isRedirect = false;
            }

            $this->_httpResponseCode = $code;

            return $this;
        }