ReqVCR.Config (ReqVCR v0.3.0)
View SourceConfiguration module for ReqVCR.
Summary
Functions
Build the configuration for ReqVCR.
Deep merge two config maps.
Check if a request is mocked.
Functions
Build the configuration for ReqVCR.
Example
iex> Config.build()
%{ignore: %{status: [401, 404, 429, 500, 502, 503]}, mode: :standby, tape_library: "priv/vcr_tapes", redact: %{body_params: false, request_headers: ["authorization"], response_headers: false, url_params: false}, tape_name: nil, mocks: %{allow_missing_tape: false}}
Deep merge two config maps.
- if both values are maps, merge them recursively
- if any value is not a map, use the value from the override or the default
Example
iex> merge_configs(%{a: 1, b: %{c: 2}}, %{b: %{d: 3}})
%{a: 1, b: %{c: 2, d: 3}}
iex> merge_configs(%{a: 1, b: %{c: 2}}, %{b: %{c: 1, d: 3}, e: 4})
%{a: 1, b: %{c: 2, d: 3}, e: 4}
Check if a request is mocked.
Example
iex> [plug: fn _ -> :ok end] |> Req.new() |> mock?()
false
iex> [plug: fn _, _ -> :ok end] |> Req.new() |> mock?()
false
iex> [plug: {Req.Test, fn _ -> :ok end}] |> Req.new() |> mock?()
false
iex> [plug: {Req.Test, fn _, _ -> :ok end}] |> Req.new() |> mock?()
false
iex> [plug: {Req.Test, HTTPClientMock}] |> Req.new() |> mock?()
true