Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/CorsAllowAll.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,28 @@
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Yiisoft\ErrorHandler\HeadersProvider;
use Yiisoft\Http\Header;

/**
* Adds Cross-Origin Resource Sharing (CORS) headers allowing everything to the response.
*/
final class CorsAllowAll implements MiddlewareInterface
{
public function __construct(
private HeadersProvider $headersProvider

Check failure on line 20 in src/CorsAllowAll.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.2-ubuntu-latest

UndefinedClass

src/CorsAllowAll.php:20:9: UndefinedClass: Class, interface or enum named Yiisoft\ErrorHandler\HeadersProvider does not exist (see https://psalm.dev/019)

Check failure on line 20 in src/CorsAllowAll.php

View workflow job for this annotation

GitHub Actions / psalm80 / PHP 8.0-ubuntu-latest

UndefinedClass

src/CorsAllowAll.php:20:9: UndefinedClass: Class, interface or enum named Yiisoft\ErrorHandler\HeadersProvider does not exist (see https://psalm.dev/019)

Check failure on line 20 in src/CorsAllowAll.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.1-ubuntu-latest

UndefinedClass

src/CorsAllowAll.php:20:9: UndefinedClass: Class, interface or enum named Yiisoft\ErrorHandler\HeadersProvider does not exist (see https://psalm.dev/019)
) {
}

public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$this->headersProvider->add(Header::ACCESS_CONTROL_ALLOW_ORIGIN, '*');

Check failure on line 26 in src/CorsAllowAll.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.2-ubuntu-latest

UndefinedClass

src/CorsAllowAll.php:26:9: UndefinedClass: Class, interface or enum named Yiisoft\ErrorHandler\HeadersProvider does not exist (see https://psalm.dev/019)

Check failure on line 26 in src/CorsAllowAll.php

View workflow job for this annotation

GitHub Actions / psalm80 / PHP 8.0-ubuntu-latest

UndefinedClass

src/CorsAllowAll.php:26:9: UndefinedClass: Class, interface or enum named Yiisoft\ErrorHandler\HeadersProvider does not exist (see https://psalm.dev/019)

Check failure on line 26 in src/CorsAllowAll.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.1-ubuntu-latest

UndefinedClass

src/CorsAllowAll.php:26:9: UndefinedClass: Class, interface or enum named Yiisoft\ErrorHandler\HeadersProvider does not exist (see https://psalm.dev/019)
$this->headersProvider->add(Header::ACCESS_CONTROL_ALLOW_METHODS, 'GET,OPTIONS,HEAD,POST,PUT,PATCH,DELETE');

Check failure on line 27 in src/CorsAllowAll.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.2-ubuntu-latest

UndefinedClass

src/CorsAllowAll.php:27:9: UndefinedClass: Class, interface or enum named Yiisoft\ErrorHandler\HeadersProvider does not exist (see https://psalm.dev/019)

Check failure on line 27 in src/CorsAllowAll.php

View workflow job for this annotation

GitHub Actions / psalm80 / PHP 8.0-ubuntu-latest

UndefinedClass

src/CorsAllowAll.php:27:9: UndefinedClass: Class, interface or enum named Yiisoft\ErrorHandler\HeadersProvider does not exist (see https://psalm.dev/019)

Check failure on line 27 in src/CorsAllowAll.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.1-ubuntu-latest

UndefinedClass

src/CorsAllowAll.php:27:9: UndefinedClass: Class, interface or enum named Yiisoft\ErrorHandler\HeadersProvider does not exist (see https://psalm.dev/019)
$this->headersProvider->add(Header::ACCESS_CONTROL_ALLOW_HEADERS, '*');

Check failure on line 28 in src/CorsAllowAll.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.2-ubuntu-latest

UndefinedClass

src/CorsAllowAll.php:28:9: UndefinedClass: Class, interface or enum named Yiisoft\ErrorHandler\HeadersProvider does not exist (see https://psalm.dev/019)

Check failure on line 28 in src/CorsAllowAll.php

View workflow job for this annotation

GitHub Actions / psalm80 / PHP 8.0-ubuntu-latest

UndefinedClass

src/CorsAllowAll.php:28:9: UndefinedClass: Class, interface or enum named Yiisoft\ErrorHandler\HeadersProvider does not exist (see https://psalm.dev/019)

Check failure on line 28 in src/CorsAllowAll.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.1-ubuntu-latest

UndefinedClass

src/CorsAllowAll.php:28:9: UndefinedClass: Class, interface or enum named Yiisoft\ErrorHandler\HeadersProvider does not exist (see https://psalm.dev/019)
$this->headersProvider->add(Header::ACCESS_CONTROL_EXPOSE_HEADERS, '*');

Check failure on line 29 in src/CorsAllowAll.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.2-ubuntu-latest

UndefinedClass

src/CorsAllowAll.php:29:9: UndefinedClass: Class, interface or enum named Yiisoft\ErrorHandler\HeadersProvider does not exist (see https://psalm.dev/019)

Check failure on line 29 in src/CorsAllowAll.php

View workflow job for this annotation

GitHub Actions / psalm80 / PHP 8.0-ubuntu-latest

UndefinedClass

src/CorsAllowAll.php:29:9: UndefinedClass: Class, interface or enum named Yiisoft\ErrorHandler\HeadersProvider does not exist (see https://psalm.dev/019)

Check failure on line 29 in src/CorsAllowAll.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.1-ubuntu-latest

UndefinedClass

src/CorsAllowAll.php:29:9: UndefinedClass: Class, interface or enum named Yiisoft\ErrorHandler\HeadersProvider does not exist (see https://psalm.dev/019)
$this->headersProvider->add(Header::ACCESS_CONTROL_ALLOW_CREDENTIALS, 'true');

Check failure on line 30 in src/CorsAllowAll.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.2-ubuntu-latest

UndefinedClass

src/CorsAllowAll.php:30:9: UndefinedClass: Class, interface or enum named Yiisoft\ErrorHandler\HeadersProvider does not exist (see https://psalm.dev/019)

Check failure on line 30 in src/CorsAllowAll.php

View workflow job for this annotation

GitHub Actions / psalm80 / PHP 8.0-ubuntu-latest

UndefinedClass

src/CorsAllowAll.php:30:9: UndefinedClass: Class, interface or enum named Yiisoft\ErrorHandler\HeadersProvider does not exist (see https://psalm.dev/019)

Check failure on line 30 in src/CorsAllowAll.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.1-ubuntu-latest

UndefinedClass

src/CorsAllowAll.php:30:9: UndefinedClass: Class, interface or enum named Yiisoft\ErrorHandler\HeadersProvider does not exist (see https://psalm.dev/019)
$this->headersProvider->add(Header::ACCESS_CONTROL_MAX_AGE, '86400');

Check failure on line 31 in src/CorsAllowAll.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.2-ubuntu-latest

UndefinedClass

src/CorsAllowAll.php:31:9: UndefinedClass: Class, interface or enum named Yiisoft\ErrorHandler\HeadersProvider does not exist (see https://psalm.dev/019)

Check failure on line 31 in src/CorsAllowAll.php

View workflow job for this annotation

GitHub Actions / psalm80 / PHP 8.0-ubuntu-latest

UndefinedClass

src/CorsAllowAll.php:31:9: UndefinedClass: Class, interface or enum named Yiisoft\ErrorHandler\HeadersProvider does not exist (see https://psalm.dev/019)

Check failure on line 31 in src/CorsAllowAll.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.1-ubuntu-latest

UndefinedClass

src/CorsAllowAll.php:31:9: UndefinedClass: Class, interface or enum named Yiisoft\ErrorHandler\HeadersProvider does not exist (see https://psalm.dev/019)

$response = $handler->handle($request);

return $response
Expand Down
Loading