Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature-refresh' into feature-re…
Browse files Browse the repository at this point in the history
…fresh
  • Loading branch information
RhysLees committed Feb 9, 2024
2 parents 8b3bd3a + f9674b3 commit 1f950a4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/PrerenderMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function handle(Request $request, Closure $next)
if ($prerenderedResponse) {
$statusCode = $prerenderedResponse->getStatusCode();

if (! $this->returnSoftHttpCodes && $statusCode >= 300 && $statusCode < 400) {
if (!$this->returnSoftHttpCodes && $statusCode >= 300 && $statusCode < 400) {
$headers = $prerenderedResponse->getHeaders();

return Redirect::to(array_change_key_case($headers, CASE_LOWER)['location'][0], $statusCode);
Expand All @@ -128,11 +128,11 @@ private function shouldShowPrerenderedPage(Request $request): bool

$isRequestingPrerenderedPage = false;

if (! $userAgent) {
if (!$userAgent) {
return false;
}

if (! $request->isMethod('GET')) {
if (!$request->isMethod('GET')) {
return false;
}

Expand All @@ -152,13 +152,13 @@ private function shouldShowPrerenderedPage(Request $request): bool
$isRequestingPrerenderedPage = true;
}

if (! $isRequestingPrerenderedPage) {
if (!$isRequestingPrerenderedPage) {
return false;
}

// only check whitelist if it is not empty
if ($this->whitelist) {
if (! $this->isListed($requestUri, $this->whitelist)) {
if (!$this->isListed($requestUri, $this->whitelist)) {
return false;
}
}
Expand Down Expand Up @@ -207,7 +207,7 @@ private function getPrerenderedPageResponse(Request $request): ?ResponseInterfac

return $this->client->get($this->prerenderUri.'/'.urlencode($protocol.'://'.$host.'/'.$path), compact('headers'));
} catch (RequestException $exception) {
if (! $this->returnSoftHttpCodes && ! empty($exception->getResponse()) && $exception->getResponse()->getStatusCode() === 404) {
if (!$this->returnSoftHttpCodes && !empty($exception->getResponse()) && $exception->getResponse()->getStatusCode() === 404) {
abort(404);
}

Expand Down

0 comments on commit 1f950a4

Please sign in to comment.