File tree 3 files changed +10
-7
lines changed
3 files changed +10
-7
lines changed Original file line number Diff line number Diff line change 20
20
21
21
### Fixes
22
22
23
+ * Add request instead of response data to ` SentryRequest ` in ` DioEventProcessor ` [ #933 ] ( https://github.com/getsentry/sentry-dart/pull/933 )
23
24
* Context Escape with ScopeCallback ([ #925 ] ( https://github.com/getsentry/sentry-dart/pull/925 ) )
24
25
25
26
## 6.6.2
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import 'package:sentry/sentry.dart';
6
6
import 'package:sentry/src/sentry_exception_factory.dart' ;
7
7
8
8
/// This is an [EventProcessor] , which improves crash reports of [DioError] s.
9
- /// It adds information about [DioError.response ] if present and also about
9
+ /// It adds information about [DioError.requestOptions ] if present and also about
10
10
/// the inner exceptions.
11
11
class DioEventProcessor implements EventProcessor {
12
12
// Because of obfuscation, we need to dynamically get the name
@@ -120,12 +120,11 @@ class DioEventProcessor implements EventProcessor {
120
120
cookies: _options.sendDefaultPii
121
121
? options.headers['Cookie' ]? .toString ()
122
122
: null ,
123
- data: _getRequestData (dioError.response ? .data),
123
+ data: _getRequestData (dioError.requestOptions .data),
124
124
);
125
125
}
126
126
127
127
/// Returns the request data, if possible according to the users settings.
128
- /// Type checks are based on DIOs [ResponseType] .
129
128
Object ? _getRequestData (dynamic data) {
130
129
if (! _options.sendDefaultPii) {
131
130
return null ;
Original file line number Diff line number Diff line change @@ -42,19 +42,22 @@ void main() {
42
42
test ('$DioEventProcessor adds request' , () {
43
43
final sut = fixture.getSut (sendDefaultPii: true );
44
44
45
+ final request = requestOptions.copyWith (
46
+ method: 'POST' ,
47
+ data: 'foobar' ,
48
+ );
45
49
final event = SentryEvent (
46
50
throwable: DioError (
47
- requestOptions: requestOptions ,
51
+ requestOptions: request ,
48
52
response: Response <dynamic >(
49
- requestOptions: requestOptions,
50
- data: 'foobar' ,
53
+ requestOptions: request,
51
54
),
52
55
),
53
56
);
54
57
final processedEvent = sut.apply (event) as SentryEvent ;
55
58
56
59
expect (processedEvent.throwable, event.throwable);
57
- expect (processedEvent.request? .method, 'GET ' );
60
+ expect (processedEvent.request? .method, 'POST ' );
58
61
expect (processedEvent.request? .queryString, 'foo=bar' );
59
62
expect (processedEvent.request? .headers, < String , String > {
60
63
'foo' : 'bar' ,
You can’t perform that action at this time.
0 commit comments