xh
、HTTPリクエストを送信するためのフレンドリーで高速なツールです。パフォーマンスの向上に焦点を当てた、HTTPIEの優れたデザインを可能な限り再注入します。
curl -sfL https://raw.githubusercontent.com/ducaale/xh/master/install.sh | sh
iwr -useb https://raw.githubusercontent.com/ducaale/xh/master/install.ps1 | iex
OS | 方法 | 指示 |
---|---|---|
どれでも | 貨物* | cargo install xh --locked |
どれでも | フーバー | huber install xh |
Android(Termux) | PKG | pkg install xh |
Android(Magisk/Kernelsu) | mmrl ** | mmrl install xhhttp |
Alpine Linux | apk *** | apk add xh |
Arch Linux | パックマン | pacman -S xh |
Debian&Ubuntu | apt **** | sudo apt install xh |
FreeBSD | フレッシュポート | pkg install xh |
NetBSD | PKGSRC | pkgin install xh |
Linux&MacOS | nixpkgs | nix-env -iA nixpkgs.xh |
Linux&MacOS | フロックス | flox install xh |
Linux&MacOS | ホームブリュー | brew install xh |
Linux&MacOS | 隠者 | hermit install xh |
macos | MacPorts | sudo port install xh |
Windows | スクープ | scoop install xh |
Windows | チョコレート | choco install xh |
Windows | ウィンゲット | winget add ducaale.xh |
*錆びた1.74以降がインストールされていることを確認してください
** MMRL CLIをインストールする必要があります
*** XHパッケージはEdgeで利用可能で、v3.17+で行われます。ネイティブTLSのみで構築されています。
**** https://apt.cli.rs/からaptリポジトリを追加する必要があります
リリースページには、Linux、MacOS、Windows用の事前に構築されたバイナリが含まれています。
Usage: xh [OPTIONS] <[METHOD] URL> [REQUEST_ITEM]... Arguments: <[METHOD] URL> The request URL, preceded by an optional HTTP method [REQUEST_ITEM]... Optional key-value pairs to be included in the request. Options: -j, --json (default) Serialize data items from the command line as a JSON object -f, --form Serialize data items from the command line as form fields --multipart Like --form, but force a multipart/form-data request even without files --raw <RAW> Pass raw request data without extra processing --pretty <STYLE> Controls output processing [possible values: all, colors, format, none] --format-options <FORMAT_OPTIONS> Set output formatting options -s, --style <THEME> Output coloring style [possible values: auto, solarized, monokai, fruity] --response-charset <ENCODING> Override the response encoding for terminal display purposes --response-mime <MIME_TYPE> Override the response mime type for coloring and formatting for the terminal -p, --print <FORMAT> String specifying what the output should contain -h, --headers Print only the response headers. Shortcut for --print=h -b, --body Print only the response body. Shortcut for --print=b -m, --meta Print only the response metadata. Shortcut for --print=m -v, --verbose... Print the whole request as well as the response --debug Print full error stack traces and debug log messages --all Show any intermediary requests/responses while following redirects with --follow -P, --history-print <FORMAT> The same as --print but applies only to intermediary requests/responses -q, --quiet... Do not print to stdout or stderr -S, --stream Always stream the response body -o, --output <FILE> Save output to FILE instead of stdout -d, --download Download the body to a file instead of printing it -c, --continue Resume an interrupted download. Requires --download and --output --session <FILE> Create, or reuse and update a session --session-read-only <FILE> Create or read a session without updating it form the request/response exchange -A, --auth-type <AUTH_TYPE> Specify the auth mechanism [possible values: basic, bearer, digest] -a, --auth <USER[:PASS] | TOKEN> Authenticate as USER with PASS (-A basic|digest) or with TOKEN (-A bearer) --ignore-netrc Do not use credentials from .netrc --offline Construct HTTP requests without sending them anywhere --check-status (default) Exit with an error status code if the server replies with an error -F, --follow Do follow redirects --max-redirects <NUM> Number of redirects to follow. Only respected if --follow is used --timeout <SEC> Connection timeout of the request --proxy <PROTOCOL:URL> Use a proxy for a protocol. For example: --proxy https:http://proxy.host:8080 --verify <VERIFY> If "no", skip SSL verification. If a file path, use it as a CA bundle --cert <FILE> Use a client side certificate for SSL --cert-key <FILE> A private key file to use with --cert --ssl <VERSION> Force a particular TLS version [possible values: auto, tls1, tls1.1, tls1.2, tls1.3] --https Make HTTPS requests if not specified in the URL --http-version <VERSION> HTTP version to use [possible values: 1.0, 1.1, 2, 2-prior-knowledge] --resolve <HOST:ADDRESS> Override DNS resolution for specific domain to a custom IP --interface <NAME> Bind to a network interface or local IP address -4, --ipv4 Resolve hostname to ipv4 addresses only -6, --ipv6 Resolve hostname to ipv6 addresses only -I, --ignore-stdin Do not attempt to read stdin --curl Print a translation to a curl command --curl-long Use the long versions of curl's flags --help Print help -V, --version Print version Each option can be reset with a --no-OPTION argument.
詳細情報については、 xh help
を実行します。
xh
HTTPIEのリクエストアイテム構文を使用して、ヘッダーを設定し、ボディ、クエリ文字列などをリクエストします。
=
/ :=
リクエストボディまたはフォームフィールドを設定する場合( =
文字列の場合:=
他のJSONタイプの場合)。
==
クエリ文字列を追加するため。
@
リクエストにファイルを含める[email protected]
など[email protected];type=image/jpeg;filename=goodbye.jpg
:
ヘッダーを追加または削除するためのconnection:keep-alive
またはconnection:
。
;
空の値をheader-without-value;
。
@
プレフィックスを使用して、ファイルから値を読み取ることができます。例: x-api-key:@api-key.txt
。
リクエスト本体は、標準の入力、または@filename
を使用したファイルからも読み取ることができます。
複雑なJSONオブジェクトを構築するには、JSONパスをキーapp[container][0][id]=090-5
として使用できます。この構文の詳細については、https://httpie.io/docs/cli/nested-jsonを参照してください。
HTTPIEと同様に、リクエストURLのスキーム部分を指定することはオプションであり、主要なコロンはローカルホストの速記として機能します。 :8000
はlocalhost:8000
:/path
相当しますlocalhost/path
URLには、URLを有効なXHまたはHTTPIEコマンドにすばやく変換できるLIEDING ://
持つことができます。たとえば、 http ://httpbin.org/json
http://httpbin.org/json
はhttp://httpbin.org/jsonになります。
xh http:// localhost:3000/users#http:// localhost:3000/usersxh localhost:3000/users#solvess to http:// localhost:3000/userxh:3000/users#ofers#solvess ofsion localhost:3000/usersxh:/users#http:// localhost:80/usersxh example.comに解決します#http://example.com://example.com#http://example.comに解決する
xh
、バイナリ名がxhs
、 https
、またはxhttps
のいずれかである場合、デフォルトでHTTPSスキームになります。パッケージマネージャーを介してxh
インストールした場合、 xh
とxhs
両方がデフォルトで利用可能になるはずです。それ以外の場合は、次のようなものを作成する必要があります。
cd/path/to/xh && ln -s ./xh ./xhs xh httpbin.org/get#http://httpbin.org/getxhs httpbin.org/getに解決#https://httpbin.org/get
xh
http
またはhttps
として(バイナリの名前を変更することにより)、またはXH_HTTPIE_COMPAT_MODE
環境変数が設定されている場合、HTTPIE互換モードで実行されます。現在の違いは、デフォルトでは--check-status
が有効になっていないことです。
#get requestxh httpbin.org/json# body {"name": "ahmed"、 "age":24} xh httpbin.org/post name = ahmed age:= 24##get request a get requestを送信するQueryString id = 5&sort = truexh get httpbin.org/json id == 5 sort == true#get requestを送信し、値12345xhのx-api-keyという名前のヘッダーを含めます。 :12345#stdin.echo "[1、2、3]"から読んでボディを使用して投稿リクエストを送信xh post httpbin.org/post# putリクエストを送信し、結果をput httpbin.org/put id:= 49 age:= 25 | LESS#ダウンロードと保存res.jsonxh -d httpbin.org/json -o res.json
スタートアップ速度が向上しました。
簡単にインストールして持ち運びができる単一の静的リンクされたバイナリとして利用できます。
HTTP/2サポート。
--curl
フラグを使用したCURLコマンドへのビルドイン翻訳。
--help
からの短い、チートシートスタイルの出力。 (より長い出力の場合、 help
に合格してください。)
HTTPIEの機能のすべてが実装されているわけではありません。 (#4)
プラグインシステムはありません。
一般的な未熟さ。 httpieは古く、よくテストされています。
より悪いドキュメント。
curlie- httpieの使いやすさを追加するカールへのフロントエンド
httpie-go-goで書かれたhttpie-like httpクライアント
curl2httpie -CurlとHttpieの間でコマンド引数を変換します