@@ -29,7 +29,7 @@ |
||
| 29 | 29 | protected function registerBindings() |
| 30 | 30 | { |
| 31 | 31 | // TODO: Change to bind the implementation to the interface instead. |
| 32 | - $this->app->bind(CorsService::class, function () { |
|
| 32 | + $this->app->bind(CorsService::class, function() { |
|
| 33 | 33 | return new CorsService(config(self::CONFIG_KEY)); |
| 34 | 34 | }); |
| 35 | 35 | |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | public function testAssertCanBeRegistered() |
| 30 | 30 | { |
| 31 | - $this->specify('verify serviceProvider is registered', function () { |
|
| 31 | + $this->specify('verify serviceProvider is registered', function() { |
|
| 32 | 32 | $service = $this->app->make(CorsService::class); |
| 33 | 33 | verify($service)->isInstanceOf(CorsService::class); |
| 34 | 34 | }); |
@@ -99,7 +99,7 @@ |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | if ($this->maxAge) { |
| 102 | - $response->headers->set('Access-Control-Max-Age', (string)$this->maxAge); |
|
| 102 | + $response->headers->set('Access-Control-Max-Age', (string) $this->maxAge); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | $allowMethods = $this->isAllMethodsAllowed() |
@@ -27,8 +27,8 @@ discard block |
||
| 27 | 27 | public function testAssertIsNotCorsRequest() |
| 28 | 28 | { |
| 29 | 29 | $middleware = new CorsMiddleware(new CorsService()); |
| 30 | - $this->specify('verify middleware is not cors request', function () use ($middleware) { |
|
| 31 | - verify($middleware->handle(new Request(), function () { |
|
| 30 | + $this->specify('verify middleware is not cors request', function() use ($middleware) { |
|
| 31 | + verify($middleware->handle(new Request(), function() { |
|
| 32 | 32 | return true; |
| 33 | 33 | }))->equals(true); |
| 34 | 34 | }); |
@@ -43,10 +43,10 @@ discard block |
||
| 43 | 43 | 'allow_origins' => ['http://example.com'], |
| 44 | 44 | ]); |
| 45 | 45 | $middleware = new CorsMiddleware($service); |
| 46 | - $this->specify('verify middleware is cors request', function () use ($middleware) { |
|
| 46 | + $this->specify('verify middleware is cors request', function() use ($middleware) { |
|
| 47 | 47 | $req = new Request(); |
| 48 | 48 | $req->headers->set('Origin', 'http://example.com'); |
| 49 | - $res = $middleware->handle($req, function () { |
|
| 49 | + $res = $middleware->handle($req, function() { |
|
| 50 | 50 | return new JsonResponse(); |
| 51 | 51 | }); |
| 52 | 52 | |
@@ -58,10 +58,10 @@ discard block |
||
| 58 | 58 | 'allow_origins' => ['http://foo.com'], |
| 59 | 59 | ]); |
| 60 | 60 | $middleware = new CorsMiddleware($service); |
| 61 | - $this->specify('Closure is called even if origin is not allowed', function () use ($middleware) { |
|
| 61 | + $this->specify('Closure is called even if origin is not allowed', function() use ($middleware) { |
|
| 62 | 62 | $req = new Request(); |
| 63 | 63 | $req->headers->set('Origin', 'http://bar.com'); |
| 64 | - $res = $middleware->handle($req, function () { |
|
| 64 | + $res = $middleware->handle($req, function() { |
|
| 65 | 65 | $res = new JsonResponse(); |
| 66 | 66 | $res->headers->set('X-Closure-Called', 1); |
| 67 | 67 | return $res; |
@@ -81,13 +81,13 @@ discard block |
||
| 81 | 81 | 'allow_methods' => ['*'], |
| 82 | 82 | ]); |
| 83 | 83 | $middleware = new CorsMiddleware($service); |
| 84 | - $this->specify('verify middleware is preflight request', function () use ($middleware) { |
|
| 84 | + $this->specify('verify middleware is preflight request', function() use ($middleware) { |
|
| 85 | 85 | $req = new Request(); |
| 86 | 86 | $req->setMethod('OPTIONS'); |
| 87 | 87 | $req->headers->set('Origin', 'http://example.com'); |
| 88 | 88 | $req->headers->set('Access-Control-Request-Method', 'GET'); |
| 89 | 89 | |
| 90 | - $res = $middleware->handle($req, function () { |
|
| 90 | + $res = $middleware->handle($req, function() { |
|
| 91 | 91 | return new JsonResponse(); |
| 92 | 92 | }); |
| 93 | 93 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | public function testServiceConfig() |
| 40 | 40 | { |
| 41 | - $this->specify('service config max_age is less than zero', function () { |
|
| 41 | + $this->specify('service config max_age is less than zero', function() { |
|
| 42 | 42 | new CorsService(['max_age' => -1]); |
| 43 | 43 | }, ['throws' => 'InvalidArgumentException']); |
| 44 | 44 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | $this->request = new Request; |
| 55 | 55 | |
| 56 | - $this->specify('200 response when origin, method and headers are allowed', function () { |
|
| 56 | + $this->specify('200 response when origin, method and headers are allowed', function() { |
|
| 57 | 57 | $this->request->headers->set('Origin', 'http://foo.com'); |
| 58 | 58 | $this->request->headers->set('Access-Control-Request-Method', 'POST'); |
| 59 | 59 | $this->request->headers->set('Access-Control-Request-Headers', 'accept, authorization, content-type'); |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | $this->request = new Request; |
| 73 | 73 | |
| 74 | - $this->specify('response headers are set', function () { |
|
| 74 | + $this->specify('response headers are set', function() { |
|
| 75 | 75 | $this->request->headers->set('Origin', 'http://foo.com'); |
| 76 | 76 | $this->request->headers->set('Access-Control-Request-Method', 'POST'); |
| 77 | 77 | $this->request->headers->set('Access-Control-Request-Headers', 'accept, authorization, content-type'); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | $this->request = new Request; |
| 95 | 95 | |
| 96 | - $this->specify('regression test for issue #31', function () { |
|
| 96 | + $this->specify('regression test for issue #31', function() { |
|
| 97 | 97 | $this->request->headers->set('Origin', 'http://foo.com'); |
| 98 | 98 | $this->request->headers->set('Access-Control-Request-Method', 'POST'); |
| 99 | 99 | $this->request->headers->set('Access-Control-Request-Headers', 'accept,authorization, content-type'); |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | $this->request = new Request; |
| 118 | 118 | |
| 119 | - $this->specify('response credentials header is set', function () { |
|
| 119 | + $this->specify('response credentials header is set', function() { |
|
| 120 | 120 | $this->request->headers->set('Origin', 'http://foo.com'); |
| 121 | 121 | $this->request->headers->set('Access-Control-Request-Method', 'POST'); |
| 122 | 122 | $this->request->headers->set('Access-Control-Request-Headers', 'accept, authorization, content-type'); |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | |
| 136 | 136 | $this->request = new Request; |
| 137 | 137 | |
| 138 | - $this->specify('response max-age header is set', function () { |
|
| 138 | + $this->specify('response max-age header is set', function() { |
|
| 139 | 139 | $this->request->headers->set('Origin', 'http://foo.com'); |
| 140 | 140 | $this->request->headers->set('Access-Control-Request-Method', 'POST'); |
| 141 | 141 | $this->request->headers->set('Access-Control-Request-Headers', 'accept, authorization, content-type'); |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | 'allow_origins' => ['*'], |
| 157 | 157 | ]); |
| 158 | 158 | |
| 159 | - $this->specify('response origin header is set', function () { |
|
| 159 | + $this->specify('response origin header is set', function() { |
|
| 160 | 160 | $this->request->headers->set('Origin', 'http://foo.com'); |
| 161 | 161 | |
| 162 | 162 | $response = $this->service->handleRequest($this->request, new Response()); |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | 'allow_origins' => ['*'], |
| 169 | 169 | ]); |
| 170 | 170 | |
| 171 | - $this->specify('response vary header is not set when all origins are allowed', function () { |
|
| 171 | + $this->specify('response vary header is not set when all origins are allowed', function() { |
|
| 172 | 172 | $this->request->headers->set('Origin', 'http://foo.com'); |
| 173 | 173 | |
| 174 | 174 | $response = new Response(); |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | 'allow_origins' => ['http://foo.com'], |
| 183 | 183 | ]); |
| 184 | 184 | |
| 185 | - $this->specify('response vary header is set', function () { |
|
| 185 | + $this->specify('response vary header is set', function() { |
|
| 186 | 186 | $this->request->headers->set('Origin', 'http://foo.com'); |
| 187 | 187 | $this->request->headers->set('Vary', 'Accept-Encoding'); |
| 188 | 188 | |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | 'allow_credentials' => true, |
| 199 | 199 | ]); |
| 200 | 200 | |
| 201 | - $this->specify('response credentials header is set', function () { |
|
| 201 | + $this->specify('response credentials header is set', function() { |
|
| 202 | 202 | $this->request->headers->set('Origin', 'http://foo.com'); |
| 203 | 203 | |
| 204 | 204 | $response = $this->service->handleRequest($this->request, new Response()); |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | 'expose_headers' => ['Accept', 'Authorization', 'Content-Type'], |
| 214 | 214 | ]); |
| 215 | 215 | |
| 216 | - $this->specify('response expose headers header is set', function () { |
|
| 216 | + $this->specify('response expose headers header is set', function() { |
|
| 217 | 217 | $this->request->headers->set('Origin', 'http://foo.com'); |
| 218 | 218 | |
| 219 | 219 | $response = $this->service->handleRequest($this->request, new Response()); |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | 'allow_origins' => ['http://foo.com', 'http://notbar.com'], |
| 226 | 226 | ]); |
| 227 | 227 | |
| 228 | - $this->specify('response origin header is not set when origin is not allowed', function () { |
|
| 228 | + $this->specify('response origin header is not set when origin is not allowed', function() { |
|
| 229 | 229 | $this->request->headers->set('Origin', 'http://bar.com'); |
| 230 | 230 | |
| 231 | 231 | $response = $this->service->handleRequest($this->request, new Response()); |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | $this->request = new Request; |
| 243 | 243 | |
| 244 | - $this->specify('cors request is recognized', function () { |
|
| 244 | + $this->specify('cors request is recognized', function() { |
|
| 245 | 245 | verify($this->service->isCorsRequest($this->request))->false(); |
| 246 | 246 | |
| 247 | 247 | $this->request->headers->set('Origin', 'http://foo.com'); |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | |
| 257 | 257 | $this->request = new Request; |
| 258 | 258 | |
| 259 | - $this->specify('preflight request is recognized', function () { |
|
| 259 | + $this->specify('preflight request is recognized', function() { |
|
| 260 | 260 | verify($this->service->isPreflightRequest($this->request))->false(); |
| 261 | 261 | |
| 262 | 262 | $this->request->setMethod('OPTIONS'); |