Skip to content

Commit

Permalink
Throw more specific exception for a request on a close IOClient (#584)
Browse files Browse the repository at this point in the history
Closes #581
  • Loading branch information
guyluz11 authored Jun 24, 2021
1 parent e89b190 commit f93c76f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## 0.13.4-dev

* Throw a more useful error when a client is used after it has been closed.

## 0.13.3

* Validate that the `method` parameter of BaseRequest is a valid "token".
Expand Down
5 changes: 5 additions & 0 deletions lib/src/io_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ class IOClient extends BaseClient {
/// Sends an HTTP request and asynchronously returns the response.
@override
Future<IOStreamedResponse> send(BaseRequest request) async {
if (_inner == null) {
throw ClientException(
'HTTP request failed. Client is already closed.', request.url);
}

var stream = request.finalize();

try {
Expand Down

0 comments on commit f93c76f

Please sign in to comment.