Skip to content

Commit 8265a44

Browse files
Merge pull request #410 from getsentry/fix-scrubber-docs
fix custom scrubber configuration docs
2 parents 7055300 + e3bb5d9 commit 8265a44

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

lib/sentry/plug_context.ex

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ defmodule Sentry.PlugContext do
2929
3030
Then pass it into Sentry.Plug:
3131
32-
use Sentry.PlugContext, body_scrubber: &scrub_params/1
32+
plug Sentry.PlugContext, body_scrubber: &MyModule.scrub_params/1
3333
3434
You can also pass it in as a `{module, fun}` like so:
3535
36-
use Sentry.PlugContext, body_scrubber: {MyModule, :scrub_params}
36+
plug Sentry.PlugContext, body_scrubber: {MyModule, :scrub_params}
3737
3838
*Please Note*: If you are sending large files you will want to scrub them out.
3939
@@ -54,11 +54,11 @@ defmodule Sentry.PlugContext do
5454
5555
Then pass it into Sentry.Plug:
5656
57-
use Sentry.PlugContext, header_scrubber: &scrub_headers/1
57+
plug Sentry.PlugContext, header_scrubber: &MyModule.scrub_headers/1
5858
5959
It can also be passed in as a `{module, fun}` like so:
6060
61-
use Sentry.PlugContext, header_scrubber: {MyModule, :scrub_headers}
61+
plug Sentry.PlugContext, header_scrubber: {MyModule, :scrub_headers}
6262
6363
### Cookie Scrubber
6464
@@ -67,8 +67,8 @@ defmodule Sentry.PlugContext do
6767
6868
To configure scrubbing, we can set all configuration keys:
6969
70-
use Sentry.PlugContext, header_scrubber: &scrub_headers/1,
71-
body_scrubber: &scrub_params/1, cookie_scrubber: &scrub_cookies/1
70+
plug Sentry.PlugContext, header_scrubber: &MyModule.scrub_headers/1,
71+
body_scrubber: &MyModule.scrub_params/1, cookie_scrubber: &MyModule.scrub_cookies/1
7272
7373
### Including Request Identifiers
7474
@@ -78,7 +78,7 @@ defmodule Sentry.PlugContext do
7878
which header key Sentry should check. It will default to "x-request-id",
7979
which Plug.RequestId (and therefore Phoenix) also default to.
8080
81-
use Sentry.PlugContext, request_id_header: "application-request-id"
81+
plug Sentry.PlugContext, request_id_header: "application-request-id"
8282
"""
8383

8484
if Code.ensure_loaded?(Plug) do

test/plug_capture_test.exs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,13 @@ defmodule Sentry.PlugCaptureTest do
3030
pass: ["*/*"],
3131
json_decoder: Jason
3232

33-
plug Sentry.PlugContext
33+
plug Sentry.PlugContext, body_scrubber: &PhoenixEndpoint.scrub_params/1
3434

3535
plug PhoenixRouter
36+
37+
def scrub_params(conn) do
38+
Sentry.PlugContext.default_body_scrubber(conn)
39+
end
3640
end
3741

3842
test "sends error to Sentry" do

0 commit comments

Comments
 (0)