Collection 02

Tools

Start from a sample input and a command whose output can be checked.

Tool entries keep the input, the exact invocation, and the observable output next to each other. They are written for the moment when a command almost does what you need.

Index

On this shelf

TaskToolWhat to check
Validate an ETag with curl Guide curl How do I send a conditional request and see whether the file is still fresh?
Compare Staged and Unstaged Changes in Git Guide Git Which diff shows what will be committed?
Missing Fields and null in jq Reference jq Why does jq print null for a missing key, and how do I distinguish missing from null?
How ripgrep Handles Ignored Files Reference ripgrep Why does rg skip a file that grep finds?

Reading path

A way in

Start with the curl validator if you need to observe a conditional HTTP exchange. Then read the cache-control entry in Protocols to interpret the result.

  1. 01 Validate an ETag with curlAn ETag check is a conditional GET: store the ETag from the first response, send it in If-None-Match with curl's --etag-compare or -H, and treat a 304 status as proof that the cached copy is still fresh. A 200 status means the validator no longer matches, so the body must be fetched again.
  2. 02 Freshness and Validation in Cache-ControlA cache can reuse a stored response without contacting the origin while that response is fresh; once it is stale, the cache must validate it conditionally unless a directive explicitly allows stale reuse.

All entries

Full catalog