diff --git a/CHANGELOG.md b/CHANGELOG.md index ab8a02203c..08a3a0b011 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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". diff --git a/lib/src/io_client.dart b/lib/src/io_client.dart index 5ee66db0f8..85d3681861 100644 --- a/lib/src/io_client.dart +++ b/lib/src/io_client.dart @@ -24,6 +24,11 @@ class IOClient extends BaseClient { /// Sends an HTTP request and asynchronously returns the response. @override Future send(BaseRequest request) async { + if (_inner == null) { + throw ClientException( + 'HTTP request failed. Client is already closed.', request.url); + } + var stream = request.finalize(); try {