Skip to content

Commit

Permalink
Merge pull request #2014 from akrabat/more-http-codes
Browse files Browse the repository at this point in the history
Add more status codes
  • Loading branch information
silentworks committed Nov 18, 2016
2 parents c888afc + ac7717c commit 66ff172
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Slim/Http/Response.php
Expand Up @@ -91,14 +91,17 @@ class Response extends Message implements ResponseInterface
416 => 'Requested Range Not Satisfiable',
417 => 'Expectation Failed',
418 => 'I\'m a teapot',
421 => 'Misdirected Request',
422 => 'Unprocessable Entity',
423 => 'Locked',
424 => 'Failed Dependency',
426 => 'Upgrade Required',
428 => 'Precondition Required',
429 => 'Too Many Requests',
431 => 'Request Header Fields Too Large',
444 => 'Connection Closed Without Response',
451 => 'Unavailable For Legal Reasons',
499 => 'Client Closed Request',
//Server Error 5xx
500 => 'Internal Server Error',
501 => 'Not Implemented',
Expand All @@ -111,6 +114,7 @@ class Response extends Message implements ResponseInterface
508 => 'Loop Detected',
510 => 'Not Extended',
511 => 'Network Authentication Required',
599 => 'Network Connect Timeout Error',
];

/**
Expand Down
6 changes: 3 additions & 3 deletions tests/Http/ResponseTest.php
Expand Up @@ -122,15 +122,15 @@ public function testGetReasonPhrase()
public function testMustSetReasonPhraseForUnrecognisedCode()
{
$response = new Response();
$response = $response->withStatus(499);
$response = $response->withStatus(199);
}

public function testSetReasonPhraseForUnrecognisedCode()
{
$response = new Response();
$response = $response->withStatus(499, 'Authentication timeout');
$response = $response->withStatus(199, 'Random Message');

$this->assertEquals('Authentication timeout', $response->getReasonPhrase());
$this->assertEquals('Random Message', $response->getReasonPhrase());
}

public function testGetCustomReasonPhrase()
Expand Down

0 comments on commit 66ff172

Please sign in to comment.