@@ -25,11 +25,10 @@ class CorsTest extends TestCase
25
25
public function it_does_modify_on_a_request_without_origin ()
26
26
{
27
27
$ app = $ this ->createStackedApp ();
28
- $ unmodifiedResponse = new Response ();
29
28
30
29
$ response = $ app ->handle (new Request ());
31
30
32
- $ this ->assertEquals ('localhost ' , $ response ->headers ->get ('Access-Control-Allow-Origin ' ));
31
+ $ this ->assertEquals ('http:// localhost ' , $ response ->headers ->get ('Access-Control-Allow-Origin ' ));
33
32
}
34
33
35
34
/**
@@ -59,7 +58,7 @@ public function it_returns_allow_origin_header_on_valid_actual_request()
59
58
$ response = $ app ->handle ($ request );
60
59
61
60
$ this ->assertTrue ($ response ->headers ->has ('Access-Control-Allow-Origin ' ));
62
- $ this ->assertEquals ('localhost ' , $ response ->headers ->get ('Access-Control-Allow-Origin ' ));
61
+ $ this ->assertEquals ('http:// localhost ' , $ response ->headers ->get ('Access-Control-Allow-Origin ' ));
63
62
}
64
63
65
64
/**
@@ -238,13 +237,13 @@ public function it_doesnt_add_a_vary_header_when_simple_origins()
238
237
public function it_adds_a_vary_header_when_multiple_origins ()
239
238
{
240
239
$ app = $ this ->createStackedApp (array (
241
- 'allowedOrigins ' => array ('localhost ' , 'http://example.com ' )
240
+ 'allowedOrigins ' => array ('http:// localhost ' , 'http://example.com ' )
242
241
));
243
242
$ request = $ this ->createValidActualRequest ();
244
243
245
244
$ response = $ app ->handle ($ request );
246
245
247
- $ this ->assertEquals ('localhost ' , $ response ->headers ->get ('Access-Control-Allow-Origin ' ));
246
+ $ this ->assertEquals ('http:// localhost ' , $ response ->headers ->get ('Access-Control-Allow-Origin ' ));
248
247
$ this ->assertTrue ($ response ->headers ->has ('Vary ' ));
249
248
}
250
249
@@ -278,12 +277,12 @@ public function it_returns_access_control_headers_on_cors_request()
278
277
{
279
278
$ app = $ this ->createStackedApp ();
280
279
$ request = new Request ();
281
- $ request ->headers ->set ('Origin ' , 'localhost ' );
280
+ $ request ->headers ->set ('Origin ' , 'http:// localhost ' );
282
281
283
282
$ response = $ app ->handle ($ request );
284
283
285
284
$ this ->assertTrue ($ response ->headers ->has ('Access-Control-Allow-Origin ' ));
286
- $ this ->assertEquals ('localhost ' , $ response ->headers ->get ('Access-Control-Allow-Origin ' ));
285
+ $ this ->assertEquals ('http:// localhost ' , $ response ->headers ->get ('Access-Control-Allow-Origin ' ));
287
286
}
288
287
289
288
/**
@@ -300,7 +299,7 @@ public function it_returns_access_control_headers_on_cors_request_with_pattern_o
300
299
$ response = $ app ->handle ($ request );
301
300
302
301
$ this ->assertTrue ($ response ->headers ->has ('Access-Control-Allow-Origin ' ));
303
- $ this ->assertEquals ('localhost ' , $ response ->headers ->get ('Access-Control-Allow-Origin ' ));
302
+ $ this ->assertEquals ('http:// localhost ' , $ response ->headers ->get ('Access-Control-Allow-Origin ' ));
304
303
$ this ->assertTrue ($ response ->headers ->has ('Vary ' ));
305
304
$ this ->assertEquals ('Origin ' , $ response ->headers ->get ('Vary ' ));
306
305
}
@@ -316,7 +315,7 @@ public function it_returns_access_control_headers_on_valid_preflight_request()
316
315
$ response = $ app ->handle ($ request );
317
316
318
317
$ this ->assertTrue ($ response ->headers ->has ('Access-Control-Allow-Origin ' ));
319
- $ this ->assertEquals ('localhost ' , $ response ->headers ->get ('Access-Control-Allow-Origin ' ));
318
+ $ this ->assertEquals ('http:// localhost ' , $ response ->headers ->get ('Access-Control-Allow-Origin ' ));
320
319
}
321
320
322
321
/**
@@ -325,7 +324,7 @@ public function it_returns_access_control_headers_on_valid_preflight_request()
325
324
public function it_does_not_allow_request_with_origin_not_allowed ()
326
325
{
327
326
$ passedOptions = array (
328
- 'allowedOrigins ' => array ('notlocalhost ' ),
327
+ 'allowedOrigins ' => array ('http:// notlocalhost ' ),
329
328
);
330
329
331
330
$ service = new CorsService ($ passedOptions );
@@ -504,15 +503,15 @@ public function it_skips_empty_access_control_request_header()
504
503
private function createValidActualRequest ()
505
504
{
506
505
$ request = new Request ();
507
- $ request ->headers ->set ('Origin ' , 'localhost ' );
506
+ $ request ->headers ->set ('Origin ' , 'http:// localhost ' );
508
507
509
508
return $ request ;
510
509
}
511
510
512
511
private function createValidPreflightRequest ()
513
512
{
514
513
$ request = new Request ();
515
- $ request ->headers ->set ('Origin ' , 'localhost ' );
514
+ $ request ->headers ->set ('Origin ' , 'http:// localhost ' );
516
515
$ request ->headers ->set ('Access-Control-Request-Method ' , 'get ' );
517
516
$ request ->setMethod ('OPTIONS ' );
518
517
@@ -524,7 +523,7 @@ private function createStackedApp(array $options = array(), array $responseHeade
524
523
$ passedOptions = array_merge (array (
525
524
'allowedHeaders ' => array ('x-allowed-header ' , 'x-other-allowed-header ' ),
526
525
'allowedMethods ' => array ('delete ' , 'get ' , 'post ' , 'put ' ),
527
- 'allowedOrigins ' => array ('localhost ' ),
526
+ 'allowedOrigins ' => array ('http:// localhost ' ),
528
527
'exposedHeaders ' => false ,
529
528
'maxAge ' => false ,
530
529
'supportsCredentials ' => false ,
0 commit comments