schachmat / wego

weather app for the terminal
ISC License
7.82k stars 476 forks source link

Consistent error with spaces (invalid character '<' looking for beginning of value) #181

Closed UdderNonsense closed 9 months ago

UdderNonsense commented 9 months ago

Using a zsh terminal on macOS 14.0;

I am noticing some issues with location names containing spaces and not containing spaces.

location=Grand Rapids,Michigan,US

When the location does not have a two-part name (no spaces), it appears to function fine. For example:

location=Houghton,Michigan,US

When separated by commas AND spaces (Houghton, Michigan, US), I can make a few calls before recieving the following error:

% wego
2024/01/25 19:01:25 Failed to fetch weather data: Unable to unmarshal response (http://api.openweathermap.org/data/2.5/forecast?q=Grand Rapids,Michigan,US&appid=XXXXXXXXXXXXXXXXXXXXX&units=metric&lang=en): invalid character '<' looking for beginning of value
The json body is: <html>
<head><title>400 Bad Request</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<hr><center>openresty</center>
</body>
</html>

This error does not occur when I spam the "wego" command where spaces are not interpreted/included

UdderNonsense commented 9 months ago

Apologies, I forgot to add a label to the issue :(

UdderNonsense commented 9 months ago

Immediately noticed new behaviour. Closing because I'm not exactly sure of the issue anymore.