|
21 | 21 | end
|
22 | 22 | end
|
23 | 23 |
|
24 |
| - context "with config.send_default_pii = true" do |
25 |
| - before do |
26 |
| - Sentry.configuration.send_default_pii = true |
27 |
| - end |
28 |
| - |
29 |
| - it "adds http breadcrumbs with query string & request body" do |
30 |
| - stub_normal_response |
31 |
| - |
32 |
| - response = Net::HTTP.get_response(URI("http://example.com/path?foo=bar")) |
33 |
| - |
34 |
| - expect(response.code).to eq("200") |
35 |
| - crumb = Sentry.get_current_scope.breadcrumbs.peek |
36 |
| - expect(crumb.category).to eq("net.http") |
37 |
| - expect(crumb.data).to eq({ status: 200, method: "GET", url: "http://example.com/path", query: "foo=bar", body: nil }) |
38 |
| - |
39 |
| - http = Net::HTTP.new("example.com") |
40 |
| - request = Net::HTTP::Get.new("/path?foo=bar") |
41 |
| - response = http.request(request) |
42 |
| - |
43 |
| - expect(response.code).to eq("200") |
44 |
| - crumb = Sentry.get_current_scope.breadcrumbs.peek |
45 |
| - expect(crumb.category).to eq("net.http") |
46 |
| - expect(crumb.data).to eq({ status: 200, method: "GET", url: "http://example.com/path", query: "foo=bar", body: nil }) |
47 |
| - |
48 |
| - request = Net::HTTP::Post.new("/path?foo=bar") |
49 |
| - request.body = 'quz=qux' |
50 |
| - response = http.request(request) |
51 |
| - |
52 |
| - expect(response.code).to eq("200") |
53 |
| - crumb = Sentry.get_current_scope.breadcrumbs.peek |
54 |
| - expect(crumb.category).to eq("net.http") |
55 |
| - expect(crumb.data).to eq( |
56 |
| - { status: 200, method: "POST", url: "http://example.com/path", query: "foo=bar", body: 'quz=qux' } |
57 |
| - ) |
58 |
| - end |
59 |
| - end |
60 |
| - |
61 |
| - context "with config.send_default_pii = false" do |
62 |
| - before do |
63 |
| - Sentry.configuration.send_default_pii = false |
64 |
| - end |
65 |
| - |
66 |
| - it "adds http breadcrumbs without query string & request body" do |
67 |
| - stub_normal_response |
68 |
| - |
69 |
| - response = Net::HTTP.get_response(URI("http://example.com/path?foo=bar")) |
70 |
| - |
71 |
| - expect(response.code).to eq("200") |
72 |
| - crumb = Sentry.get_current_scope.breadcrumbs.peek |
73 |
| - expect(crumb.category).to eq("net.http") |
74 |
| - expect(crumb.data).to eq({ status: 200, method: "GET", url: "http://example.com/path" }) |
75 |
| - |
76 |
| - http = Net::HTTP.new("example.com") |
77 |
| - request = Net::HTTP::Get.new("/path?foo=bar") |
78 |
| - response = http.request(request) |
79 |
| - |
80 |
| - expect(response.code).to eq("200") |
81 |
| - crumb = Sentry.get_current_scope.breadcrumbs.peek |
82 |
| - expect(crumb.category).to eq("net.http") |
83 |
| - expect(crumb.data).to eq({ status: 200, method: "GET", url: "http://example.com/path" }) |
84 |
| - |
85 |
| - request = Net::HTTP::Post.new("/path?foo=bar") |
86 |
| - request.body = 'quz=qux' |
87 |
| - response = http.request(request) |
88 |
| - |
89 |
| - expect(response.code).to eq("200") |
90 |
| - crumb = Sentry.get_current_scope.breadcrumbs.peek |
91 |
| - expect(crumb.category).to eq("net.http") |
92 |
| - expect(crumb.data).to eq({ status: 200, method: "POST", url: "http://example.com/path" }) |
93 |
| - end |
| 24 | + it "adds http breadcrumbs with query string & request body" do |
| 25 | + stub_normal_response |
| 26 | + |
| 27 | + response = Net::HTTP.get_response(URI("http://example.com/path?foo=bar")) |
| 28 | + |
| 29 | + expect(response.code).to eq("200") |
| 30 | + crumb = Sentry.get_current_scope.breadcrumbs.peek |
| 31 | + expect(crumb.category).to eq("net.http") |
| 32 | + expect(crumb.data).to eq({ status: 200, method: "GET", url: "http://example.com/path", query: "foo=bar" }) |
| 33 | + |
| 34 | + http = Net::HTTP.new("example.com") |
| 35 | + request = Net::HTTP::Get.new("/path?foo=bar") |
| 36 | + response = http.request(request) |
| 37 | + |
| 38 | + expect(response.code).to eq("200") |
| 39 | + crumb = Sentry.get_current_scope.breadcrumbs.peek |
| 40 | + expect(crumb.category).to eq("net.http") |
| 41 | + expect(crumb.data).to eq({ status: 200, method: "GET", url: "http://example.com/path", query: "foo=bar" }) |
| 42 | + |
| 43 | + request = Net::HTTP::Post.new("/path?foo=bar") |
| 44 | + request.body = 'quz=qux' |
| 45 | + response = http.request(request) |
| 46 | + |
| 47 | + expect(response.code).to eq("200") |
| 48 | + crumb = Sentry.get_current_scope.breadcrumbs.peek |
| 49 | + expect(crumb.category).to eq("net.http") |
| 50 | + expect(crumb.data).to eq( |
| 51 | + { status: 200, method: "POST", url: "http://example.com/path", query: "foo=bar", body: 'quz=qux' } |
| 52 | + ) |
94 | 53 | end
|
95 | 54 |
|
96 | 55 | it "doesn't record breadcrumb for the SDK's request" do
|
|
115 | 74 | expect(response.code).to eq("200")
|
116 | 75 | crumb = Sentry.get_current_scope.breadcrumbs.peek
|
117 | 76 | expect(crumb.category).to eq("net.http")
|
118 |
| - expect(crumb.data).to eq({ status: 200, method: "GET", url: "http://example.com/path" }) |
| 77 | + expect(crumb.data).to eq({ status: 200, method: "GET", query: "foo=bar", url: "http://example.com/path" }) |
119 | 78 | end
|
120 | 79 | end
|
121 | 80 | end
|
0 commit comments