Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExVCR.Filter.filter_request_header #71

Merged
merged 2 commits into from
Aug 11, 2016
Merged

ExVCR.Filter.filter_request_header #71

merged 2 commits into from
Aug 11, 2016

Conversation

smeevil
Copy link
Contributor

@smeevil smeevil commented Aug 11, 2016

Added a new function to filter the request headers of cassettes: ExVCR.Filter.filter_request_header
Added test for hackney, ibrowse and httpc.
Updated Readme to explain usage.

Example config:

config :exvcr, [
  vcr_cassette_library_dir: "test/fixture/vcr_cassettes",
  custom_cassette_library_dir: "test/fixture/custom_cassettes",
  filter_sensitive_data: [
    [pattern: "<PASSWORD>.+</PASSWORD>", placeholder: "PASSWORD_PLACEHOLDER"]
  ],
  filter_request_headers: ["X-Algolia-API-Key", "X-Algolia-Application-Id"],
  filter_url_params: false,
  response_headers_blacklist: []
]

Or to just remove a header when using a cassette:

use_cassette "index/add" do
  ExVCR.Config.filter_request_headers("X-Algolia-API-Key")
  {:ok, "my_test_id", 1395699332} = AlgoliaSearch.Index.add(@index, "my_test_id", "foo", "moo")    end

This would also close #69

Let me know if this solution is ok :)

@coveralls
Copy link

coveralls commented Aug 11, 2016

Coverage Status

Coverage decreased (-0.1%) to 93.412% when pulling 4ae7a08 on smeevil:master into 25c3c82 on parroty:master.

@parroty parroty merged commit 2c56919 into parroty:master Aug 11, 2016
@parroty
Copy link
Owner

parroty commented Aug 11, 2016

Great, thanks!

@smeevil
Copy link
Contributor Author

smeevil commented Aug 11, 2016

My pleasure, thanks for the great library and the very quick merge / release !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filter request headers
3 participants