block[weather]: fix place name geocoding for OpenWeatherMap#2266
Open
cdbrkfxrpt wants to merge 2 commits intogreshake:masterfrom
Open
block[weather]: fix place name geocoding for OpenWeatherMap#2266cdbrkfxrpt wants to merge 2 commits intogreshake:masterfrom
cdbrkfxrpt wants to merge 2 commits intogreshake:masterfrom
Conversation
ammgws
reviewed
Apr 7, 2026
Collaborator
Can you please move this into a separate commit? |
The OpenWeatherMap geo API expects literal commas in the `q` parameter (e.g. "London,UK"), but `query_pairs_mut().append_pair()` percent-encodes them into "%2C", causing the request to 404. Build the query string with `format!` and `Url::join` instead, which preserves the commas. Also add a trailing slash to `GEO_URL` so that `join` resolves relative paths correctly. Adds an `#[ignore]`d integration test that verifies place-based geocoding against the live API.
Move `Service::get_location_query` out of the impl block into a standalone async function. Use `api_key` from provided `Config`, instead of needlessly taking it as a parameter.
Author
done |
ammgws
approved these changes
Apr 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Using
query_pairs_mut().append_pair()to build the geo URL percent-encodes the comma in place names like "London,UK", turning it into "London%2CUK" and causing the request to 404. Build the query string directly instead to preserve the comma as-is.While here, move
get_location_queryout ofimpl Serviceinto a free function and resolve the API key fromconfiginternally rather than threading it through as a parameter. Add a trailing slash toGEO_URLso thatUrl::joinworks correctly with relative path segments. Add an ignored integration test for place name resolution.