Skip to content

Commit 7b55a2c

Browse files
authored
Pass a Function(dynamic) to stream.handleError (#429)
Fixes #418 The argument type for `handleError` is `Function` to allow callbacks that do or don't take the `StackTrace` argument, so we don't get static checking. In either case the first argument is expected to allow `dynamic`. TODO: Add a test
1 parent 49a3e63 commit 7b55a2c

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.12.2
2+
3+
* Fix error handler callback type for response stream errors to avoid masking
4+
root causes.
5+
16
## 0.12.1
27

38
* Add `IOStreamedResponse` which includes the ability to detach the socket.

lib/src/io_client.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ class IOClient extends BaseClient {
4545
});
4646

4747
return IOStreamedResponse(
48-
response.handleError(
49-
(HttpException error) =>
50-
throw ClientException(error.message, error.uri),
51-
test: (error) => error is HttpException),
48+
response.handleError((error) {
49+
final httpException = error as HttpException;
50+
throw ClientException(httpException.message, httpException.uri);
51+
}, test: (error) => error is HttpException),
5252
response.statusCode,
5353
contentLength:
5454
response.contentLength == -1 ? null : response.contentLength,

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: http
2-
version: 0.12.1
2+
version: 0.12.2
33
homepage: https://github.com/dart-lang/http
44
description: A composable, multi-platform, Future-based API for HTTP requests.
55

0 commit comments

Comments
 (0)