fix/headerauth-crash-missing-header #19
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/headerauth-crash-missing-header"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixed crash with missing header relies on #18
fix/headerauth-crash-missing-headerto fix/headerauth-crash-missing-header@ -15,6 +15,10 @@ class HeaderAuth*/public function handle(Request $request, Closure $next): Response{if (is_null($request->header('X-BOTAUTH'))) {If do empty here instead of is_null
@ -15,6 +15,10 @@ class HeaderAuth*/public function handle(Request $request, Closure $next): Response{if (empty($request->header('X-BOTAUTH'))) {->hasHeader(...)also works instead of having to do the empty check.Alternatively you can do this:
->header(...)has a second parameter that can be specified as a default value when header is not present.Most of the time in Laravel when there's a "get" kind of function like this there's a secondary "default" parameter that defaults to null you can use, for example config(...), Arr::get(...), etc.
fix/headerauth-crash-missing-headerto fix/headerauth-crash-missing-header