Aggiornato Composer
This commit is contained in:
22
vendor/asm89/stack-cors/README.md
vendored
22
vendor/asm89/stack-cors/README.md
vendored
@@ -22,13 +22,13 @@ This package can be used as a library or as [stack middleware].
|
||||
|
||||
| Option | Description | Default value |
|
||||
|------------------------|------------------------------------------------------------|---------------|
|
||||
| allowedMethods | Matches the request method. | `[]` |
|
||||
| allowedOrigins | Matches the request origin. | `[]` |
|
||||
| allowedOriginsPatterns | Matches the request origin with `preg_match`. | `[]` |
|
||||
| allowedHeaders | Sets the Access-Control-Allow-Headers response header. | `[]` |
|
||||
| exposedHeaders | Sets the Access-Control-Expose-Headers response header. | `false` |
|
||||
| maxAge | Sets the Access-Control-Max-Age response header. | `false` |
|
||||
| supportsCredentials | Sets the Access-Control-Allow-Credentials header. | `false` |
|
||||
| `allowedMethods` | Matches the request method. | `[]` |
|
||||
| `allowedOrigins` | Matches the request origin. | `[]` |
|
||||
| `allowedOriginsPatterns` | Matches the request origin with `preg_match`. | `[]` |
|
||||
| `allowedHeaders` | Sets the Access-Control-Allow-Headers response header. | `[]` |
|
||||
| `exposedHeaders` | Sets the Access-Control-Expose-Headers response header. | `false` |
|
||||
| `maxAge` | Sets the Access-Control-Max-Age response header.<br/>Set to `null` to omit the header/use browser default. | `0` |
|
||||
| `supportsCredentials` | Sets the Access-Control-Allow-Credentials header. | `false` |
|
||||
|
||||
The _allowedMethods_ and _allowedHeaders_ options are case-insensitive.
|
||||
|
||||
@@ -36,6 +36,8 @@ You don't need to provide both _allowedOrigins_ and _allowedOriginsPatterns_. If
|
||||
|
||||
If `['*']` is provided to _allowedMethods_, _allowedOrigins_ or _allowedHeaders_ all methods / origins / headers are allowed.
|
||||
|
||||
If _supportsCredentials_ is `true`, you must [explicitly set](https://fetch.spec.whatwg.org/#cors-protocol-and-credentials) `allowedHeaders` for any headers which are not CORS safelisted.
|
||||
|
||||
### Example: using the library
|
||||
|
||||
```php
|
||||
@@ -49,8 +51,8 @@ $cors = new CorsService([
|
||||
'allowedOrigins' => ['http://localhost'],
|
||||
'allowedOriginsPatterns' => ['/localhost:\d/'],
|
||||
'exposedHeaders' => false,
|
||||
'maxAge' => false,
|
||||
'supportsCredentials' => false,
|
||||
'maxAge' => 600,
|
||||
'supportsCredentials' => true,
|
||||
]);
|
||||
|
||||
$cors->addActualRequestHeaders(Response $response, $origin);
|
||||
@@ -77,7 +79,7 @@ $app = new Cors($app, [
|
||||
// you can enter regexes that are matched to the origin request header
|
||||
'allowedOriginsPatterns' => ['/localhost:\d/'],
|
||||
'exposedHeaders' => false,
|
||||
'maxAge' => false,
|
||||
'maxAge' => 600,
|
||||
'supportsCredentials' => false,
|
||||
]);
|
||||
```
|
||||
|
||||
14
vendor/asm89/stack-cors/composer.json
vendored
14
vendor/asm89/stack-cors/composer.json
vendored
@@ -12,12 +12,12 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.2|^8.0",
|
||||
"symfony/http-foundation": "^4|^5|^6",
|
||||
"symfony/http-kernel": "^4|^5|^6"
|
||||
"php": "^7.3|^8.0",
|
||||
"symfony/http-foundation": "^5.3|^6|^7",
|
||||
"symfony/http-kernel": "^5.3|^6|^7"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^7|^9",
|
||||
"phpunit/phpunit": "^9",
|
||||
"squizlabs/php_codesniffer": "^3.5"
|
||||
},
|
||||
"autoload": {
|
||||
@@ -37,7 +37,9 @@
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.1-dev"
|
||||
"dev-master": "2.2-dev"
|
||||
}
|
||||
}
|
||||
},
|
||||
"minimum-stability": "beta",
|
||||
"prefer-stable": true
|
||||
}
|
||||
|
||||
2
vendor/asm89/stack-cors/src/Cors.php
vendored
2
vendor/asm89/stack-cors/src/Cors.php
vendored
@@ -43,7 +43,7 @@ class Cors implements HttpKernelInterface
|
||||
$this->cors = new CorsService(array_merge($this->defaultOptions, $options));
|
||||
}
|
||||
|
||||
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true): Response
|
||||
public function handle(Request $request, int $type = HttpKernelInterface::MAIN_REQUEST, bool $catch = true): Response
|
||||
{
|
||||
if ($this->cors->isPreflightRequest($request)) {
|
||||
$response = $this->cors->handlePreflightRequest($request);
|
||||
|
||||
Reference in New Issue
Block a user