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

codeigniter4 / CodeIgniter4 / 37986190232

09 Oct 2026 08:19PM UTC coverage: 50.703% (-39.5%) from 90.183%
37986190232

Pull #10606

github

web-flow
Merge 2cebb1efa into 7822cde17
Pull Request #10606: fix: refresh REQUEST after URI GET normalization

17 of 30 new or added lines in 2 files covered. (56.67%)

10012 existing lines in 288 files now uncovered.

12871 of 25385 relevant lines covered (50.7%)

87.05 hits per line

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

69.23
/system/HTTP/Message.php
1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * This file is part of CodeIgniter 4 framework.
7
 *
8
 * (c) CodeIgniter Foundation <admin@codeigniter.com>
9
 *
10
 * For the full copyright and license information, please view
11
 * the LICENSE file that was distributed with this source code.
12
 */
13

14
namespace CodeIgniter\HTTP;
15

16
use CodeIgniter\Exceptions\InvalidArgumentException;
17

18
/**
19
 * An HTTP message
20
 *
21
 * @see \CodeIgniter\HTTP\MessageTest
22
 */
23
class Message implements MessageInterface
24
{
25
    use MessageTrait;
26

27
    /**
28
     * Protocol version
29
     *
30
     * @var string|null
31
     */
32
    protected $protocolVersion;
33

34
    /**
35
     * List of valid protocol versions
36
     *
37
     * @var list<string>
38
     */
39
    protected $validProtocolVersions = [
40
        '1.0',
41
        '1.1',
42
        '2.0',
43
        '3.0',
44
    ];
45

46
    /**
47
     * Message body
48
     *
49
     * @var string|null
50
     */
51
    protected $body;
52

53
    /**
54
     * Returns the Message's body.
55
     *
56
     * @return string|null
57
     */
58
    public function getBody()
59
    {
60
        return $this->body;
153 ✔
61
    }
62

63
    /**
64
     * Returns an array containing all headers.
65
     *
66
     * @return array<string, Header> An array of the request headers
67
     *
68
     * @deprecated Use Message::headers() to make room for PSR-7
69
     *
70
     * @TODO Incompatible return value with PSR-7
71
     *
72
     * @codeCoverageIgnore
73
     */
74
    public function getHeaders(): array
75
    {
76
        return $this->headers();
77
    }
78

79
    /**
80
     * Returns a single header object. If multiple headers with the same
81
     * name exist, then will return an array of header objects.
82
     *
83
     * @deprecated Use Message::header() to make room for PSR-7
84
     *
85
     * @TODO Incompatible return value with PSR-7
86
     *
87
     * @codeCoverageIgnore
88
     *
89
     * @return array<string, Header>|Header|null
90
     */
91
    public function getHeader(string $name)
92
    {
93
        return $this->header($name);
94
    }
95

96
    /**
97
     * Determines whether a header exists.
98
     */
99
    public function hasHeader(string $name): bool
100
    {
101
        $origName = $this->getHeaderName($name);
88 ✔
102

103
        return isset($this->headers[$origName]);
88 ✔
104
    }
105

106
    /**
107
     * Retrieves a comma-separated string of the values for a single header.
108
     *
109
     * This method returns all of the header values of the given
110
     * case-insensitive header name as a string concatenated together using
111
     * a comma.
112
     *
113
     * NOTE: Not all header values may be appropriately represented using
114
     * comma concatenation. For such headers, use getHeader() instead
115
     * and supply your own delimiter when concatenating.
116
     */
117
    public function getHeaderLine(string $name): string
118
    {
119
        if ($this->hasMultipleHeaders($name)) {
554 ✔
UNCOV
120
            throw new InvalidArgumentException(
×
UNCOV
121
                'The header "' . $name . '" already has multiple headers.'
×
UNCOV
122
                . ' You cannot use getHeaderLine().',
×
UNCOV
123
            );
×
124
        }
125

126
        $origName = $this->getHeaderName($name);
554 ✔
127

128
        if (! array_key_exists($origName, $this->headers)) {
554 ✔
129
            return '';
511 ✔
130
        }
131

132
        return $this->headers[$origName]->getValueLine();
138 ✔
133
    }
134

135
    /**
136
     * Returns the HTTP Protocol Version.
137
     */
138
    public function getProtocolVersion(): string
139
    {
140
        return $this->protocolVersion ?? '1.1';
111 ✔
141
    }
142
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc