Skip to content

Commit dbad109

Browse files
fix(http): correct HTTP 418 description and coverage (#823)
Co-authored-by: Enzo Innocenzi <[email protected]>
1 parent 1bd7a67 commit dbad109

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/Tempest/Http/src/Status.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function description(): string
131131
415 => 'Unsupported Media Type',
132132
416 => 'Range Not Satisfiable',
133133
417 => 'Expectation Failed',
134-
418 => 'I Am A Teapot',
134+
418 => "I'm a teapot",
135135
421 => 'Misdirected Request',
136136
422 => 'Unprocessable Content',
137137
423 => 'Locked',

src/Tempest/Http/tests/StatusTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
*/
1414
final class StatusTest extends TestCase
1515
{
16-
private function descriptionToStatus(string $description): Status
16+
private static function descriptionToStatus(string $description): Status
1717
{
1818
$description = strtoupper(
19-
str_replace([' ', '-'], '_', $description),
19+
str_replace("'", '', str_replace([' ', '-'], '_', $description)),
2020
);
2121

2222
return Status::{$description};
@@ -28,7 +28,7 @@ public function test_status_code(int $code, string $description): void
2828
$status = Status::code($code);
2929

3030
$this->assertSame(
31-
$this->descriptionToStatus($description),
31+
self::descriptionToStatus($description),
3232
$status,
3333
);
3434

@@ -100,6 +100,7 @@ public static function provide_status_code_cases(): iterable
100100
[303, 'See Other'],
101101
[304, 'Not Modified'],
102102
[305, 'Use Proxy'],
103+
[306, 'Unused'],
103104
[307, 'Temporary Redirect'],
104105
[308, 'Permanent Redirect'],
105106

@@ -121,6 +122,7 @@ public static function provide_status_code_cases(): iterable
121122
[415, 'Unsupported Media Type'],
122123
[416, 'Range Not Satisfiable'],
123124
[417, 'Expectation Failed'],
125+
[418, "I'm a teapot"],
124126
[421, 'Misdirected Request'],
125127
[422, 'Unprocessable Content'],
126128
[423, 'Locked'],

0 commit comments

Comments
 (0)