Skip to content

Latest commit

 

History

History
132 lines (97 loc) · 3.91 KB

File metadata and controls

132 lines (97 loc) · 3.91 KB

httping

English | 日本語

httping header

Python 3.9+ License: MIT Tests

curl のフラグを暗記する必要のない、軽量で依存ゼロの HTTP リクエストテスター。

特徴

  • 依存ゼロ -- Python 標準ライブラリ (http.client) のみ使用
  • 全 HTTP メソッド対応 -- GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS
  • タイミング詳細 -- DNS, 接続, 送信, 待機, 受信, 合計時間
  • 構造化出力 -- 見やすいテキストまたは機械可読な JSON
  • バッチテスト -- YAML/JSON 定義から複数リクエストを一括実行
  • 回帰テスト -- ベースラインとの比較、タイミング閾値による検証
  • ステータス検証 -- CI 連携のための期待ステータスコード検証
  • 認証対応 -- Basic 認証を組み込みでサポート

インストール

PyPI から(推奨)

pip install httping-cli

ソースから

git clone https://github.com/izag8216/httping.git
cd httping
pip install -e .

スタンドアロン(インストール不要)

python -m httping.cli get https://api.example.com

クイックスタート

# シンプルな GET
httping get https://httpbin.org/get

# JSON ボディ付き POST
httping post https://httpbin.org/post \
  --body '{"name":"alice"}' \
  --headers "Content-Type: application/json"

# 詳細タイミング表示
httping get https://httpbin.org/get --timing

# パイプライン向け JSON 出力
httping get https://httpbin.org/get --json | jq '.status'

# ステータス検証(不一致時は終了コード 1)
httping post https://httpbin.org/post --validate-status 201

コマンド一覧

コマンド 説明
get / post / put / delete / patch / head / options HTTP リクエスト送信
request <METHOD> <URL> 任意メソッドでリクエスト送信
batch <file> YAML/JSON から複数リクエスト実行
compare <baseline> スナップショットとレスポンス比較

バッチテスト

requests.yaml を定義:

- url: https://api.example.com/health
  method: GET
- url: https://api.example.com/users
  method: POST
  body: '{"name":"alice"}'
  headers:
    Content-Type: application/json

実行:

httping batch requests.yaml --output results.json

回帰テスト

# ベースラインを取得
httping get https://api.example.com/users --json > baseline.json

# 後で比較
httping get https://api.example.com/users --json > current.json
httping compare baseline.json --against current.json --threshold 100

ドキュメント

なぜ httping か?

ツール 依存関係 構造化出力 タイミング バッチ 比較
curl C バイナリ なし なし なし なし
httpie Python 多数 あり なし なし なし
xh Rust バイナリ あり なし なし なし
httping ゼロ あり あり あり あり

ライセンス

MIT -- 依存関係の監査については THIRD_PARTY_LICENSES.md を参照。