Skip to content

Commit baffa41

Browse files
authored
feat: respond http 500 when API error occurs (merge pull request #195 from gnh1201/main)
Response HTTP 500 when API error
2 parents f6ec8b1 + 43ae649 commit baffa41

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

api.php

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
}
2525

2626
$results = fetch_search_results($opts, false);
27+
if (array_key_exists("error", $results)) {
28+
http_response_code(500);
29+
}
2730
header("Content-Type: application/json");
2831
echo json_encode($results);
2932
?>

0 commit comments

Comments
 (0)