Skip to content

zoo api --method GET -F sends fields as a JSON body instead of query parameters #1752

Description

@sneg55

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions