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
نظام التشغيل | طريقة | يأمر |
---|---|---|
أي | البضائع* | cargo install xh --locked |
أي | هوبر | huber install xh |
Android (Termux) | PKG | pkg install xh |
Android (Magisk/kernelsu) | MMRL ** | mmrl install xhhttp |
جبال الألب لينكس | apk *** | apk add xh |
قوس لينكس | باكمان | pacman -S xh |
ديبيان وأوبونتو | apt **** | sudo apt install xh |
FreeBsd | Freshports | 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 |
ماكوس | macports | sudo port install xh |
النوافذ | مغرفة | scoop install xh |
النوافذ | الشوكولاتة | choco install xh |
النوافذ | وينجيت | winget add ducaale.xh |
* تأكد من تثبيت Rust 1.74 أو لاحقًا
** ستحتاج إلى تثبيت MMRL CLI
*** تتوفر حزمة XH في الحافة وستكون في V3.17+. وهو مبني مع TLS الأصلي فقط.
**** ستحتاج إلى إضافة مستودع APT من https://apt.cli.rs/
تحتوي صفحة الإصدار على ثنائيات تم إنشاؤها مسبقًا لـ 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
بناء جملة Ided-Item من HTTPIE لضبط الرؤوس ، وطلب الجسم ، وسلسلة الاستعلام ، إلخ.
=
/ :=
لتحديد حقول JSON أو النماذج الخاصة بطلب ( =
للسلاسل و :=
لأنواع JSON الأخرى).
==
لإضافة سلاسل الاستعلام.
@
لتضمين الملفات في طلبات متعددة على eg [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 كمفتاح EG 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 صالح. على سبيل المثال http://httpbin.org/json
يصبح http ://httpbin.org/json
.
XH http: // localhost: 3000/user # يحلون إلى http: // localhost: 3000/usersxh localhost: 3000/user to solles to http: // localhost: 3000/userSxh: 3000/users # res solves to http: // // LocalHost: 3000/usersxh:/المستخدمون # يحلون إلى http: // localhost: 80/usersxh example.com # يحل إلى http: //example.comxh: //example.com # يحل إلى http://example.com
سيقوم xh
بالتخلف عن مخطط HTTPS إذا كان الاسم الثنائي هو واحد من xhs
أو https
أو xhttps
. إذا قمت بتثبيت xh
عبر مدير الحزمة ، فيجب أن يكون كل من xh
و xhs
متاحًا افتراضيًا. خلاف ذلك ، تحتاج إلى إنشاء واحد مثل هذا:
قرص مضغوط/مسار/إلى/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# send a get request مع QueryString ID = 5 & sort = truexh get httpbin.org/json id == 5 sort == true# send a request request وقم بتضمين رأس يدعى x-api-key مع القيمة 12345xH get httpbin.org/json x-ap-ke : 12345# أرسل طلبًا منشورًا مع قراءة الجسم من stdin.echo "[1 ، 2 ، 3]" | XH post httpbin.org/post# إرسال طلب وضع وأنابيب النتيجة إلى lessxh وضع httpbin.org/put معرف: = 49 العمر: = 25 | أقل# قم بتنزيل وحفظ إلى Res.jsonxh -d httpbin.org/json-o res.json# تقديم طلب مع AgentSxh httpbin.org/get user-agent: foobar
تحسين سرعة بدء التشغيل.
متوفر كثنائي مرتبط بشكل ثابت يسهل تثبيته وحمله.
HTTP/2 دعم.
بنيت ترجمة إلى أوامر حليقة مع العلم --curl
.
قصيرة ، الإخراج على غرار Cheatsheet من- --help
. (لمخرجات أطول ، تمرير help
.)
لا يتم تنفيذ جميع ميزات HTTPIE. (#4)
لا يوجد نظام إضافي.
عدم النضج العام. Httpie قديم ومختبر جيدًا.
وثائق أسوأ.
Curlie - الواجهة الأمامية إلى حليقة تضيف سهولة استخدام httpie
Httpie-Go-Httpie-like HTTP Client مكتوب في Go
Curl2httpie - تحويل وسيطات الأوامر بين Curl و Httpie