update check for api key
This commit is contained in:
parent
87867746aa
commit
caac722a72
@ -23,7 +23,7 @@ class ApiAuth
|
|||||||
{
|
{
|
||||||
// Check if Authorization header is in place
|
// Check if Authorization header is in place
|
||||||
$auth = $request->header('Authorization', null);
|
$auth = $request->header('Authorization', null);
|
||||||
if(empty($auth)) {
|
if($auth === null) {
|
||||||
return $this->unauthorized('Authorization header missing');
|
return $this->unauthorized('Authorization header missing');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,9 @@ class ApiTest extends TestCase
|
|||||||
$this->withHeaders(['Authorization' => 'invalidKey'])->get($uri)
|
$this->withHeaders(['Authorization' => 'invalidKey'])->get($uri)
|
||||||
->assertStatus(401);
|
->assertStatus(401);
|
||||||
|
|
||||||
|
$this->withHeaders(['Authorization' => ''])->get($uri)
|
||||||
|
->assertStatus(401);
|
||||||
|
|
||||||
// Test upper/lower case of Authorization header, etc
|
// Test upper/lower case of Authorization header, etc
|
||||||
$this->withHeaders($this->apiHeaders())->get($uri)
|
$this->withHeaders($this->apiHeaders())->get($uri)
|
||||||
->assertStatus(200)
|
->assertStatus(200)
|
||||||
|
Loading…
Reference in New Issue
Block a user