Skip to content

Commit

Permalink
Bugfix: Allow numeric options (#209)
Browse files Browse the repository at this point in the history
Closes: #208
  • Loading branch information
daveshah authored Aug 9, 2023
1 parent 9a8ba54 commit 8f73e3e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/exvcr/filter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ defmodule ExVCR.Filter do
@doc """
Filter out senstive data from the response.
"""
def filter_sensitive_data(body) do
def filter_sensitive_data(body) when is_binary(body) do
if String.valid?(body) do
replace(body, ExVCR.Setting.get(:filter_sensitive_data))
else
body
end
end
def filter_sensitive_data(body), do: body

@doc """
Filter out senstive data from the request header.
Expand Down
4 changes: 4 additions & 0 deletions test/filter_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ defmodule ExVCR.FilterTest do
ExVCR.Config.filter_sensitive_data(nil)
end

test "filter_sensitive_data handles non string values" do
assert ExVCR.Filter.filter_sensitive_data(60_000) == 60000
end

test "filter_url_params" do
url = "https://example.com/api?test1=foo&test2=bar"

Expand Down

0 comments on commit 8f73e3e

Please sign in to comment.