Repository navigation
Conversation
backlog-js appends `?` and the encoded params to the path without checking for an existing `?`. `bee api 'issues?count=2' -f order=desc` was sent as `issues?count=2?order=desc`, and the API read the count as `2?order=desc` and rejected it with "error.number : count". For GET, the query string is now split off the endpoint and sent as params together with `-f` / `-F`, as `gh api` does. The pairs are sent as literal strings, like `-F`. Other methods send the fields in the body and leave the URL alone, so their endpoint is kept as given. Fixes nulab#188
This branch has not been deployed
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.
Summary
bee apisent a GET endpoint's query string and the-ffields as two query strings, because backlog-js appends?and the params to the path without checking for an existing?. The API then read the-ffields as part of the last value from the endpoint.This takes option 1 from #188:
-f/-F, asgh apidoes. The pairs are sent as literal strings, like-F.[]keys and repeated keys become arrays the same way as with-f.--helpdescription now says that a query string in a GET endpoint is sent with the fields.Evidence
Read-only GET runs of the built CLI against a live space, with API key authentication:
mainat707ab80)bee api 'users/myself/recentlyViewedIssues?count=2' -f order=descerror.number : count, exit 1bee api 'notifications/count?alreadyRead=false' -f resourceAlreadyRead=falseCannot parse parameter alreadyRead as Boolean, exit 1-fbee api 'users/myself/recentlyViewedIssues?count=2&order=desc'bee api 'users/myself/recentlyViewedIssues?count=3' -f order=asc(anddesc)-f count=3 -f order=asc(anddesc)The new GET test failed before the fix and passes after it. The POST test passes before and after; it keeps the split limited to GET.
Not verified:
+is sent as a space (%20). Most servers read a raw query string the same way, but I did not compare this case against the live API.Test plan
vp checkvp testvp run --filter @nulab/bee buildvp run --filter @nulab/bee generate:skill:checkMerge Danger
Door: Two-way
The change can be reverted without a data migration.
Blast Radius:
bee apiGETA GET endpoint with a query string and no
-falready worked onmain. It now sends the same parameters as params instead of as part of the path.Fixes #188