Skip to content

Commit

Permalink
Edit HttpRequire
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinBubu committed Oct 3, 2021
1 parent 3c9d25b commit fc3e51d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/HttpRequire/HttpRequire.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Bubu\Http\HttpRequire;

use Bubu\Http\HttpRequire\Exception\HttpRequireException;
use Bubu\Http\Reponse\Reponse;

class HttpRequire
{
Expand All @@ -19,8 +20,7 @@ public static function https(bool $throwException = false)
} else {
if (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] === 'off') {
$location = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
header('HTTP/1.1 301 Moved Permanently');
header('Location: ' . $location);
(new Reponse)->reponse301()->createHeader('Location', $location)->setup()->send();
exit;
}
}
Expand Down
6 changes: 3 additions & 3 deletions tests/index.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

use Bubu\Http\HttpRequire\HttpRequire;
use Bubu\Http\Reponse\Reponse;
use Bubu\Http\Session\Session;

require '../vendor/autoload.php';

$dotenv = Dotenv\Dotenv::createImmutable('../');
$dotenv->load();

(new Reponse)->setHttpCode(999)->setHttpMessage('Ouiiiiiii')->setup()->send();
HttpRequire::https();
(new Reponse)->setHttpCode(200)->setHttpMessage('Ouiiiiiii')->setup()->send();

0 comments on commit fc3e51d

Please sign in to comment.