Two command-line tools for repeatable HTTP requests:
xdiff-livesends two configured requests and displays their response diff.xreq-livesends one configured request and prints its response.
cargo install --path .Create a YAML configuration containing one or more named profiles:
---
rust:
req1:
method: GET
url: https://staging.example.com/api/status
headers:
user-agent: xdiff-live
params:
verbose: true
req2:
method: GET
url: https://production.example.com/api/status
params:
verbose: true
res:
skip_headers:
- date
- set-cookie
skip_body:
- request_idRun the comparison:
xdiff-live run --profile rust --config xdiff.ymlskip_body currently removes top-level JSON object fields. skip_headers removes
the selected response headers case-insensitively before comparison. Response
headers are sorted so their wire order does not create false differences. The two
configured requests are sent concurrently through the same HTTP client.
An xreq configuration contains named request profiles:
---
create-todo:
method: POST
url: https://example.com/todos
headers:
content-type: application/json
body:
title: hello
completed: falsexreq-live run --profile create-todo --config xreq.ymlBoth commands require --profile and --config for run.
Pass --extra-params (-e) more than once to override a request:
xreq-live run -p create-todo -c xreq.yml \
-e page=first \
-e count:=10 \
-e %authorization="Bearer token" \
-e @title="updated title" \
-e @completed:=truekey=valuesets a query parameter as a string.%key=valuesets a request header as a string.@key=valuesets a body field as a string.key:=JSONand@key:=JSONpreserve JSON types such as numbers, booleans, arrays, and objects.
JSON bodies are used by default when a body is present. Set content-type to
application/x-www-form-urlencoded or multipart/form-data to select another
encoding. Multipart currently supports text fields; file parts are not yet
supported.
Requests have a 10-second connection timeout, a 30-second overall timeout, and a maximum of 10 redirects. Response bodies are limited to 10 MiB.
xdiff-live run returns status 0 when responses match, 1 when they differ, and
2 when execution fails. xreq-live returns 0 on success and 2 on an execution
or configuration error. Errors are written to stderr.
The parse subcommand accepts URLs interactively and prints generated YAML:
xdiff-live parse
xreq-live parse