| Index: tests/standalone/io/http_redirect_test.dart
|
| diff --git a/tests/standalone/io/http_redirect_test.dart b/tests/standalone/io/http_redirect_test.dart
|
| index 0b2f13329eafb41a1886d564de8fe0295d0e3cfc..4df9782b8ec0c3de39b553d2f9cb6935c74976d4 100644
|
| --- a/tests/standalone/io/http_redirect_test.dart
|
| +++ b/tests/standalone/io/http_redirect_test.dart
|
| @@ -128,6 +128,18 @@ HttpServer setupServer() {
|
| }
|
| );
|
|
|
| + // Setup redirect where we close the connection.
|
| + server.addRequestHandler(
|
| + (HttpRequest request) => request.path == "/closing",
|
| + (HttpRequest request, HttpResponse response) {
|
| + response.headers.set(HttpHeaders.LOCATION,
|
| + "http://127.0.0.1:${server.port}/");
|
| + response.statusCode = HttpStatus.FOUND;
|
| + response.persistentConnection = false;
|
| + response.outputStream.close();
|
| + }
|
| + );
|
| +
|
| return server;
|
| }
|
|
|
| @@ -352,6 +364,27 @@ void testRedirectLoop() {
|
| };
|
| }
|
|
|
| +void testRedirectClosingConnection() {
|
| + HttpServer server = setupServer();
|
| + HttpClient client = new HttpClient();
|
| +
|
| + int redirectCount = 0;
|
| + HttpClientConnection conn =
|
| + client.getUrl(Uri.parse("http://127.0.0.1:${server.port}/closing"));
|
| +
|
| + conn.followRedirects = true;
|
| + conn.onResponse = (HttpClientResponse response) {
|
| + response.inputStream.onData = () => Expect.fail("Response not expected");
|
| + response.inputStream.onClosed = () => Expect.fail("Response not expected");
|
| + };
|
| + conn.onError = (e) {
|
| + Expect.isTrue(e is RedirectException);
|
| + Expect.isNull(e.redirects);
|
| + server.close();
|
| + client.shutdown();
|
| + };
|
| +}
|
| +
|
| main() {
|
| testManualRedirect();
|
| testManualRedirectWithHeaders();
|
| @@ -361,4 +394,5 @@ main() {
|
| testAutoRedirect303POST();
|
| testAutoRedirectLimit();
|
| testRedirectLoop();
|
| + testRedirectClosingConnection();
|
| }
|
|
|