Fix wrong test in getCrityInformation

master
Loïc Blot 2019-11-08 19:29:02 +01:00 committed by GitHub
parent dbdc625ddb
commit bd21a4af07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -135,6 +135,11 @@ class CityController extends IntermediateController {
"http://api.openweathermap.org/data/2.5/forecast?q=".urlencode($name)."&mode=json&APPID=".urlencode($apiKey))[1],
true);
// If no cod we just return a 502 as the API is not responding properly
if (!in_array('cod', $cityDatas)) {
return array("code" => 502, "response" => null);
}
if ($cityDatas['cod'] != '200') {
return array("code" => $cityDatas['cod'], "response" => null, "apikey" => $apiKey);
}