Skip to content

Commit

Permalink
Merge branch 'master' of github.com:parroty/exvcr
Browse files Browse the repository at this point in the history
  • Loading branch information
parroty committed Aug 9, 2023
2 parents 0913d6c + 8f73e3e commit 406af2d
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
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
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 406af2d

Please sign in to comment.