File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ private function buildPreflightCheckResponse(Request $request)
116
116
117
117
$ response ->headers ->set ('Access-Control-Allow-Origin ' , $ request ->headers ->get ('Origin ' ));
118
118
119
- if ($ this ->options ['maxAge ' ]) {
119
+ if ($ this ->options ['maxAge ' ] !== null ) {
120
120
$ response ->headers ->set ('Access-Control-Max-Age ' , $ this ->options ['maxAge ' ]);
121
121
}
122
122
Original file line number Diff line number Diff line change @@ -402,6 +402,33 @@ public function it_sets_max_age_when_set()
402
402
$ this ->assertEquals (42 , $ response ->headers ->get ('Access-Control-Max-Age ' ));
403
403
}
404
404
405
+ /**
406
+ * @test
407
+ */
408
+ public function it_sets_max_age_when_zero ()
409
+ {
410
+ $ app = $ this ->createStackedApp (array ('maxAge ' => 0 ));
411
+ $ request = $ this ->createValidPreflightRequest ();
412
+
413
+ $ response = $ app ->handle ($ request );
414
+
415
+ $ this ->assertTrue ($ response ->headers ->has ('Access-Control-Max-Age ' ));
416
+ $ this ->assertEquals (0 , $ response ->headers ->get ('Access-Control-Max-Age ' ));
417
+ }
418
+
419
+ /**
420
+ * @test
421
+ */
422
+ public function it_doesnt_set_max_age_when_false ()
423
+ {
424
+ $ app = $ this ->createStackedApp (array ('maxAge ' => null ));
425
+ $ request = $ this ->createValidPreflightRequest ();
426
+
427
+ $ response = $ app ->handle ($ request );
428
+
429
+ $ this ->assertFalse ($ response ->headers ->has ('Access-Control-Max-Age ' ));
430
+ }
431
+
405
432
/**
406
433
* @test
407
434
*/
You can’t perform that action at this time.
0 commit comments