Skip to content

Commit f93c76f

Browse files
authored
Throw more specific exception for a request on a close IOClient (#584)
Closes #581
1 parent e89b190 commit f93c76f

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## 0.13.4-dev
22

3+
* Throw a more useful error when a client is used after it has been closed.
4+
35
## 0.13.3
46

57
* Validate that the `method` parameter of BaseRequest is a valid "token".

lib/src/io_client.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ class IOClient extends BaseClient {
2424
/// Sends an HTTP request and asynchronously returns the response.
2525
@override
2626
Future<IOStreamedResponse> send(BaseRequest request) async {
27+
if (_inner == null) {
28+
throw ClientException(
29+
'HTTP request failed. Client is already closed.', request.url);
30+
}
31+
2732
var stream = request.finalize();
2833

2934
try {

0 commit comments

Comments
 (0)