zoo api --method GET -F key=value sends the fields as a JSON body instead of a query string, contradicting its own help
Context: API Makeathon participant. Found while reviewing the raw api command.
zoo api's help says --method GET sends fields as a query string (src/cmd_api.rs:16-23). The implementation serializes -F fields into a request body regardless of method (src/cmd_api.rs:95-104), selects GET (:108-114), and only moves fields into the URL inside the unrelated --input branch (:120-148). So --method GET -F key=value without --input keeps the JSON body and leaves the URL unchanged.
Concrete failure
zoo api /fixture --method GET -F limit=10 produces a GET whose URL has no limit query parameter and whose body contains {"limit": 10}. API endpoints that read query parameters ignore the filter, or reject the unexpected GET body.
Verify
Capture the request produced by zoo api /fixture --method GET -F limit=10: the URL has no limit query and the body carries the JSON object.
Suggested fix
When the method is GET (and --input is not used), move -F fields into the query string, matching the documented behavior.
Environment
Zoo CLI v0.2.184 (33534cd). Reviewed against the current main of KittyCAD/cli.
zoo api --method GET -F key=valuesends the fields as a JSON body instead of a query string, contradicting its own helpContext: API Makeathon participant. Found while reviewing the raw
apicommand.zoo api's help says--method GETsends fields as a query string (src/cmd_api.rs:16-23). The implementation serializes-Ffields into a request body regardless of method (src/cmd_api.rs:95-104), selects GET (:108-114), and only moves fields into the URL inside the unrelated--inputbranch (:120-148). So--method GET -F key=valuewithout--inputkeeps the JSON body and leaves the URL unchanged.Concrete failure
zoo api /fixture --method GET -F limit=10produces a GET whose URL has nolimitquery parameter and whose body contains{"limit": 10}. API endpoints that read query parameters ignore the filter, or reject the unexpected GET body.Verify
Capture the request produced by
zoo api /fixture --method GET -F limit=10: the URL has nolimitquery and the body carries the JSON object.Suggested fix
When the method is GET (and
--inputis not used), move-Ffields into the query string, matching the documented behavior.Environment
Zoo CLI v0.2.184 (33534cd). Reviewed against the current
mainof KittyCAD/cli.