The API:
'https://fcc-weather-api.glitch.me/api/current?lat=' + lat + '&lon=' + lon
Can cause problems when trying to get the weather icon code. Depending on the weather, the weather:{}
object’s array length can can either be 1 or 2. When weather:{}
length is 1, the icon value is a URL (example):
https://cdn.glitch.com/6e8889e5-7a72-48f0-a061-863548450de5%2F01n.png?1499366020783
Where 01n
is the icon code and needs to be extracted from the URL. But when weather:{}
length is 2, the icon is in the second index and its value is (example):
01n
Although it’s possible to write code to extract the icon depending on weather:{}
length, I think the API should be more consistent so that we can receive predictable results for every request.