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 |
안드로이드 (용기) | PKG | pkg install xh |
안드로이드 (Magisk/Kernelsu) | MMRL ** | mmrl install xhhttp |
알파인 리눅스 | APK *** | apk add xh |
아치 리눅스 | 팩맨 | pacman -S xh |
데비안 & 우분투 | 적절한**** | sudo apt install xh |
freebsd | 신입생 | pkg install xh |
netbsd | pkgsrc | pkgin install xh |
Linux & Macos | nixpkgs | nix-env -iA nixpkgs.xh |
Linux & Macos | FLOX | flox install xh |
Linux & Macos | 홈브류 | brew install xh |
Linux & Macos | 은자 | hermit install xh |
마코스 | 맥 포트 | sudo port install xh |
창 | 국자 | scoop install xh |
창 | 초콜릿 | choco install xh |
창 | 윙엣 | winget add ducaale.xh |
* Rust 1.74 이상이 설치되어 있는지 확인하십시오.
** MMRL CLI를 설치해야합니다
*** XH 패키지는 가장자리에서 사용할 수 있으며 v3.17+입니다. Native-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 또는 형태 필드를 설정하기 위해 ( =
문자열의 경우 :=
다른 json 유형의 경우).
==
쿼리 문자열을 추가합니다.
@
멀티 파트 요청에 파일을 포함시키기 위해 eg [email protected]
또는 [email protected];type=image/jpeg;filename=goodbye.jpg
.
:
헤더 추가 또는 제거를 위해 예를 들어 connection:keep-alive
또는 connection:
.
;
빈 값을 가진 헤더를 포함시키기위한 경우 header-without-value;
.
@
prefix를 사용하여 파일에서 값을 읽을 수 있습니다. 예를 들면 : x-api-key:@api-key.txt
.
요청 본문은 표준 입력 또는 @filename
사용하는 파일에서 읽을 수도 있습니다.
복잡한 JSON 객체를 구성하기 위해 JSON 경로를 키 app[container][0][id]=090-5
로 사용할 수 있습니다. 이 구문에 대한 자세한 내용은 https://httpie.io/docs/cli/nested-json을 참조하십시오.
httpie와 유사하게 요청 URL의 체계 부분을 지정하는 것은 선택 사항이며, 선행 콜론은 LocalHost의 속기로 작동합니다. :8000
localhost:8000
과 동일하며 :/path
localhost/path
와 같습니다.
URL에는 유효한 XH 또는 HTTPIE 명령으로 URL을 빠르게 변환 할 수있는 선행 ://
가질 수 있습니다. 예를 들어 http://httpbin.org/json
http ://httpbin.org/json
이됩니다.
xh http : // localhost : 3000/user # # http : // localhost : 3000/usersxh localhost : 3000/users # http : // localhost : 3000/usersxh : 3000/users # http : // localhost : 3000/usersxh :/users # http : // localhost : 80/usersxh example.com # http : //example.comxh : //example.com #로 해결됩니다.
바이너리 이름이 xhs
, https
또는 xhttps
중 하나 인 경우 xh
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 get a get request querystring id = 5 & sort = truexh get httpbin.org/json id == 5 sort == true# get 요청을 보내고 값이 value httpbin.org/json x-api-key라는 x- 아피-키라는 헤더를 포함시킵니다. : 12345# 신체로 게시물 요청 보내기 stdin.echo "[1, 2, 3]"| xh post httpbin.org/post# put 요청을 보내고 결과를 httpbin.org/put id를 putt로 put니다 : = 49 연령 : = 25 | 적은# 다운로드 및 Res.jsonxh -d httpbin.org/json -o res.json# 사용자 정의 사용자 agentxh httpbin.org/get user-agent와 함께 요청하십시오 : foobar
시작 속도 향상.
설치하고 운반하기 쉬운 단일 정적으로 연결된 바이너리로 제공됩니다.
HTTP/2 지원.
--curl
플래그가있는 컬 명령으로 변환.
짧은 치트 시트 스타일의 --help
에서. (더 긴 출력을 위해 help
받으십시오.)
Httpie의 모든 기능이 구현되는 것은 아닙니다. (#4)
플러그인 시스템이 없습니다.
일반적인 미성숙. httpie는 오래되고 잘 테스트되었습니다.
더 나쁜 문서.
Curlie- httpie의 사용 편의성을 더하는 컬의 프론트 엔드
httpie-go-httpie-like http 클라이언트는 GO에 작성되었습니다
curl2httpie- 컬과 httpie 사이의 명령 인수를 변환합니다