Skip to content

Commit bf32d21

Browse files
authored
Fix 404 Not Found detection (#151)
1 parent 01c8bfd commit bf32d21

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Cmfcmf/OpenWeatherMap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ private function cacheOrFetchResult($url)
584584
$response = $this->httpClient->sendRequest($this->httpRequestFactory->createRequest("GET", $url));
585585
$result = $response->getBody()->getContents();
586586
if ($response->getStatusCode() !== 200) {
587-
if ($result === "{\"message\":\"not found\"}\n" && $response->getStatusCode() === 404) {
587+
if (false !== strpos($result, 'not found') && $response->getStatusCode() === 404) {
588588
throw new OWMNotFoundException();
589589
}
590590
throw new OWMException('OpenWeatherMap returned a response with status code ' . $response->getStatusCode() . ' and the following content `'. $result . '`');

0 commit comments

Comments
 (0)