Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 3dd13fe

Browse files
committed
Exception code ranges below 400 should be cast to 500
- Fixes weierophinney/problem-details#3
1 parent 4d842e7 commit 3dd13fe

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

src/CommonProblemDetails.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public static function createFromThrowable(
116116

117117
private static function normalizeStatus(int $status) : int
118118
{
119-
if ($status < 100 || $status > 599) {
119+
if ($status < 400 || $status > 599) {
120120
return 500;
121121
}
122122

test/ProblemDetailsJsonResponseTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public function outOfRangeStatusCodes()
8080
{
8181
return [
8282
99 => [99],
83+
399 => [399],
8384
600 => [600],
8485
0 => [0],
8586
'string' => ['string'],

test/ProblemDetailsXmlResponseTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public function outOfRangeStatusCodes()
8080
{
8181
return [
8282
99 => [99],
83+
399 => [399],
8384
600 => [600],
8485
0 => [0],
8586
'string' => ['string'],

0 commit comments

Comments
 (0)