You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Shelf 1.1.1 introduced a breaking change. By changing the runtime type of request bodies from Stream<List<int>> to Stream<Uint8List>, it caused it to no longer work with instances of StreamTransformer<List<int>, List<int>> such as dart:io's gzip.encoder and gzip.decoder. This is a breaking change and, if it was necessary, should have been released with a major version bump.
The following code works with shelf 1.1.0 and not with 1.1.1:
import'dart:io';
import'package:shelf/shelf.dart'as shelf;
import'package:shelf/shelf_io.dart'as shelf_io;
Future<void> main() async {
var server =await shelf_io.serve((request) async {
await request.read().transform(gzip.decoder).drain();
return shelf.Response.ok("");
}, "localhost", 0);
var client =HttpClient();
var request =await client.post("localhost", server.port, "/");
await request.close();
client.close(force:true);
server.close();
}