sentry-dart icon indicating copy to clipboard operation
sentry-dart copied to clipboard

NoSuchMethodError: method not found: 'headers' on null during tests

Open marandaneto opened this issue 3 years ago • 2 comments

On CI:

test/http_client/tracing_client_test.dart: TracingClient captured span adds sentry-trace header to the request (failed) NoSuchMethodError: method not found: 'headers' on null test/http_client/tracing_client_test.dart 111:32

Likely because of https://pub.dev/packages/http/versions/0.13.5

expect(response.request!.headers['sentry-trace'],
          span.toSentryTrace().value);

response.request is null likely, something has changed.

marandaneto avatar Aug 04 '22 11:08 marandaneto

@ueman do you know if something has changed? just noticed it but I didn't see any change in that class.

marandaneto avatar Aug 04 '22 11:08 marandaneto

Sorry, no idea. If I had to guess, it's because of

In MockHttpClient use the callback returned Response.request instead of the argument value to give more control to the callback. This may be breaking for callbacks which return incomplete Responses and relied on the default.

as mentioned in the changelog for the newest version.

ueman avatar Aug 04 '22 11:08 ueman