ReqVCR (ReqVCR v0.2.0)
View SourceA module to record and replay HTTP requests and responses.
The tape files are stored in the <priv_dir>/vcr_tapes
directory.
Once a tape is recorded, it will be replayed for subsequent requests.
Each tape file is a JSON file containing the request and response data. The filename is generated from the request method, URL, and a checksum of the URL + query parameters.
Headers are also sanitized to remove sensitive information before being stored in the tape.
The header keys sanitized are ["authorization"]
at the moment.
The ReqVCR.attach/2
function can be used to attach the VCR to a request and response pipeline.
Examples
iex> [url: "https://example.com"] |> Req.new() |> ReqVCR.attach()
iex> [url: "https://example.com", allow_overwrite: true] |> Req.new() |> ReqVCR.attach()
iex> [url: "https://example.com", ignore_status: ["404"]] |> Req.new() |> ReqVCR.attach()
Summary
Functions
Attaches the VCR Recorder to a request and response pipeline.