pystac-client
pystac-client copied to clipboard
Fix `query` in GET requests
Related Issue(s):
- Closes #355
Description:
Fixes query in GET requests by stringifying the JSON dictionary. Note that (for the Planetary Computer at least) the query parameter cannot be url encoded. @philvarner do you think this is a server bug? If so I can open it on stac-fastapi.
PR Checklist:
- [x] Code is formatted
- [x] Tests pass
- [x] Changes are added to the CHANGELOG
The query value should be url encoded, so it's a bug if stac-fastapi isn't handling that correctly.
The query value should be url encoded, so it's a bug if stac-fastapi isn't handling that correctly.
I've opened https://github.com/stac-utils/stac-fastapi/pull/504 to fix, and added url encoding to this PR. However, this means that tests will be broken until the Planetary Computer picks up stac-utils/stac-fastapi#504. I think it's worth waiting to merge this PR until the Planetary Computer is fixed, since this isn't a critical fix.
Agree with waiting -- I only found it because I had a get endpoint that was proxying through a stac api request, and I just wanted to pass the parameters through to pystac-client needing to parse them, but that was easy enough to do.
Codecov Report
Base: 85.05% // Head: 85.12% // Increases project coverage by +0.07% :tada:
Coverage data is based on head (
375b97c) compared to base (00e4c98). Patch coverage: 100.00% of modified lines in pull request are covered.
Additional details and impacted files
@@ Coverage Diff @@
## main #362 +/- ##
==========================================
+ Coverage 85.05% 85.12% +0.07%
==========================================
Files 11 11
Lines 823 827 +4
==========================================
+ Hits 700 704 +4
Misses 123 123
| Impacted Files | Coverage Δ | |
|---|---|---|
| pystac_client/item_search.py | 93.01% <100.00%> (+0.03%) |
:arrow_up: |
| pystac_client/stac_api_io.py | 87.06% <100.00%> (+0.22%) |
:arrow_up: |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
Okay, I'm marking this ready to review. Even if the Planetary Computer doesn't support quoted dictionaries in GET requests, users can always use POST.