Skip to content

Commit

Permalink
better CORS handling (#977)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgershman authored Mar 21, 2024
1 parent 731bec0 commit d551463
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

### 4.3.2 (UNRELEASED)
* Fixes some admin logins for BMLT users with special characters. [#973]
* Fixes validation for when there is no phone number set for volunteers on the Admin interface [#975]
* Fixes validation for when there is no phone number set for volunteers on the Admin interface. [#975]
* Improvements for CORS handling.

### 4.3.1 (March 19, 2024)
* Fixes for call blasting and post call handling. [#960]
Expand Down
1 change: 1 addition & 0 deletions app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Kernel extends HttpKernel
protected $middleware = [
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Illuminate\Http\Middleware\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
Expand Down
2 changes: 1 addition & 1 deletion config/cors.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
|
*/

'paths' => ['api/*'],
'paths' => ['*'],

'allowed_methods' => ['*'],

Expand Down
10 changes: 10 additions & 0 deletions tests/Feature/UpgradeAdvisorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@
->assertSeeText(sprintf("bro({\"version\":\"%s\"})", $settings->version()), false);
})->with(['GET', 'POST']);

test('version test check cors headers', function ($method) {
$settings = new SettingsService();
app()->instance(SettingsService::class, $settings);
$response = $this->call($method, '/version');
$response
->assertStatus(200)
->assertHeader("Access-Control-Allow-Origin", "*")
->assertSeeText(sprintf("{\"version\":\"%s\"}", $settings->version()), false);
})->with(['GET', 'POST']);

test('test with misconfigured phone number', function ($method) {
$misconfiguredNumber = "+18889822614";
$settingsService = new SettingsService();
Expand Down

0 comments on commit d551463

Please sign in to comment.