code_scout_http 1.1.0
code_scout_http: ^1.1.0 copied to clipboard
HTTP client wrapper for CodeScout. Automatically captures network requests, responses, and errors.
1.1.0 #
Added #
-
codeScoutRequestIdnames the call a response came from. It is on anyhttp.BaseResponsethis client returns,ResponseandStreamedResponsealike, and on aBaseRequestyou send through it. Pass it asrequestIdwhen you log something about the call, such as a body your model could not read, and CodeScout shows the log with the call: in the in-app panel, and on the dashboard, whererequest:<id>finds both.final response = await client.get(Uri.parse('https://api.example.com/v2/cart')); try { return Cart.fromJson(jsonDecode(response.body) as Map<String, dynamic>); } catch (e, st) { CodeScout.instance.e( 'Could not read GET /v2/cart', error: e is FormatException ? 'FormatException: ${e.message}' : e, stackTrace: st, requestId: response.codeScoutRequestId, ); rethrow; }The
requestIdargument arrived incode_scout1.6.0. The error you log is not redacted, and aFormatExceptionfromjsonDecodequotes the part of the body where parsing stopped, so the example logs only its message.
Changed #
response.requestis the request you sent through this client. It used to be whatever the wrapped client reported, which is nothing fromMockClientand a copy fromRetryClient, and neither of those could be traced back to the call.
Fixed #
- A failed call no longer records the error's own text. That text is not
redacted, and dart:io's can quote the request: a header value it rejects, such
as an
Authorizationtoken that ends in a newline, and the bytes of a streamed body longer than itscontentLength. Both reached the call's error even withRedactionBehavior.recommended()set. A socket failure still says why, such asConnection refused, because those words carry nothing of the request but its host. Any other error is named by its type alone.
1.0.3 #
Changed #
- The name reads CodeScout, one word. The description published with 1.0.2 still said "Code Scout", because the rename landed after that version went out and pub.dev only takes a new listing with a new version.
- The readme says what the rest of CodeScout does. It used to end at the licence, so somebody who installed this for package:http capture had no way to learn that live device streaming, the database browser and the agent tools exist.
No code changed in this release.
1.0.2 #
Changed #
- The declared minimum is now Flutter 3.38 (Dart 3.10), where it used to say Flutter 3.0. That old number was never true, so pub.dev advertised compatibility with releases that could not resolve the package. Nothing about the code changed.
1.0.1 #
- Fix:
CodeScoutHttpClientreturned an already-drained response stream, breaking every request made through it (Stream has already been listened to). The body is now buffered and an equivalent response is returned to the caller. - Fix: capture is wrapped defensively. A CodeScout failure can no longer
fail the underlying HTTP request (e.g. when used before
CodeScout.init()).
1.0.0 #
- Initial release.
- HTTP client wrapper that automatically captures network requests, responses, and errors for CodeScout.