Skip to content

Commit

Permalink
Add Precognition-Success header (#47081)
Browse files Browse the repository at this point in the history
  • Loading branch information
timacdonald committed May 15, 2023
1 parent ab18c4a commit 38693f4
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Precognition.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static function afterValidationHook($request)
{
return function ($validator) use ($request) {
if ($validator->messages()->isEmpty() && $request->headers->has('Precognition-Validate-Only')) {
abort(204);
abort(204, headers: ['Precognition-Success' => 'true']);
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ public function dispatch(Route $route, $callable)
{
$this->resolveParameters($route, $callable);

abort(204);
abort(204, headers: ['Precognition-Success' => 'true']);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function dispatch(Route $route, $controller, $method)

$this->resolveParameters($route, $controller, $method);

abort(204);
abort(204, headers: ['Precognition-Success' => 'true']);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ function precognitive($callable = null)
});

if (request()->isPrecognitive()) {
abort(204);
abort(204, headers: ['Precognition-Success' => 'true']);
}

return $payload;
Expand Down
Loading

0 comments on commit 38693f4

Please sign in to comment.