Skip to content

Instantly share code, notes, and snippets.

@stknohg
Last active June 14, 2017 04:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stknohg/02950784b34594391177431ce32bcc58 to your computer and use it in GitHub Desktop.
Save stknohg/02950784b34594391177431ce32bcc58 to your computer and use it in GitHub Desktop.
HTTPieをコマンドプロンプト、PowerShellコンソール上で実行するアレ
REM コマンドプロンプトで実行する場合
REM " を \ でエスケープし ' は除外する。
http post http://localhost/ json:=[\"http\",\"pies\"] -v -p HB
# PowerShellコンソールで実行する場合
# " を \ でエスケープ
http post http://localhost/ json:='[\"http\",\"pies\"]' -v -p HB
# または ' を使わずに以下の様にしてもOK。
http post http://localhost/ "json:=[\""http\"",\""pies\""]" -v -p HB
@stknohg
Copy link
Author

stknohg commented Jun 14, 2017

Windows 10, Python 3.6.0, HTTPie 0.9.9で実施。

@itn3000
Copy link

itn3000 commented Jun 14, 2017

cmd.exeはシングルクォートを特別視せずにそのまま解釈して渡すので、JSON的に正しくない文字列として解釈されてるんではないでしょうか。

@stknohg
Copy link
Author

stknohg commented Jun 14, 2017

@itn3000 その様です。シングルクオートを使わないのが良さそうですね。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment