ducaale / xh

Friendly and fast tool for sending HTTP requests
MIT License
4.96k stars 90 forks source link

Incorrect Syntax Reference #350

Closed ethanmsl closed 5 months ago

ethanmsl commented 5 months ago

The xh docs specifically mention accepting json path like syntax and refer the user to the httpie syntax docs. Specifically:

http pie.dev/post \
  platform[name]=HTTPie \
  platform[about][mission]='Make APIs simple and intuitive' \
  platform[about][homepage]=httpie.io \
  platform[about][homepage]=httpie.io \
  platform[about][stars]:=54000 \
  platform[apps][]=Terminal \
  platform[apps][]=Desktop \
  platform[apps][]=Web \
  platform[apps][]=Mobile

However xh does not appear to accept this syntax. Replacing httpie with xh or xhs just leads to a series of zsh: command not found:.. as the command doesn't await input. Placing the command on a single ine or prefacing with --json does not remedy the situation.

I similarly tried with command that I know work as cURL commands and was unable to make xh recognize any nested json commands. If there is someway to convince xh to accept the syntax then some example may assist.

ducaale commented 5 months ago

Brackets have a special meaning in zsh so you will have to either precede your command with noglob or surround each request item with quotes

$ xh pie.dev/post \
  'platform[name]=HTTPie' \
  "platform[about][mission]='Make APIs simple and intuitive'" \
  'platform[about][homepage]=httpie.io' \
  'platform[about][homepage]=httpie.io' \
  'platform[about][stars]:=54000' \
  'platform[apps][]=Terminal' \
  'platform[apps][]=Desktop' \
  'platform[apps][]=Web' \
  'platform[apps][]=Mobile'

Also, see https://stackoverflow.com/a/71307929