• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

slimphp / Slim-Skeleton / 3875948887

pending completion
3875948887

push

github

GitHub
Merge pull request #304 from slimphp/dependabot/composer/phpunit/phpunit-tw-9.5.27

94 of 162 relevant lines covered (58.02%)

1.99 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Application/ResponseEmitter/ResponseEmitter.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace App\Application\ResponseEmitter;
6

7
use Psr\Http\Message\ResponseInterface;
8
use Slim\ResponseEmitter as SlimResponseEmitter;
9

10
class ResponseEmitter extends SlimResponseEmitter
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function emit(ResponseInterface $response): void
16
    {
17
        // This variable should be set to the allowed host from which your API can be accessed with
18
        $origin = $_SERVER['HTTP_ORIGIN'] ?? '';
×
19

20
        $response = $response
×
21
            ->withHeader('Access-Control-Allow-Credentials', 'true')
×
22
            ->withHeader('Access-Control-Allow-Origin', $origin)
×
23
            ->withHeader(
×
24
                'Access-Control-Allow-Headers',
×
25
                'X-Requested-With, Content-Type, Accept, Origin, Authorization',
×
26
            )
×
27
            ->withHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, PATCH, DELETE, OPTIONS')
×
28
            ->withHeader('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0')
×
29
            ->withAddedHeader('Cache-Control', 'post-check=0, pre-check=0')
×
30
            ->withHeader('Pragma', 'no-cache');
×
31

32
        if (ob_get_contents()) {
×
33
            ob_clean();
×
34
        }
35

36
        parent::emit($response);
×
37
    }
38
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc