1

I'd like to compress the HTTP response in Rikulo Stream. Do I have to invoke GZIP explicitly? Or, there is an option to enable?

alamoos
  • 35
  • 3

2 Answers2

2

You can configure it at startup as follows:

new StreamServer().start()
.then((HttpChannel channel) {
  channel.httpServer.autoCompress = true;
});
Tom Yeh
  • 1,987
  • 2
  • 15
  • 23
0

I haven't tried it and I didn't use Rikulo Stream myself yet but according to server example code I found in the Github Repo it should be possible to set it like

GZIP compression was the default for Dart HTTP server until recently but was changed and needs to be activated explicitely.

void serverInfo(HttpConnect connect) {
  final info = {"name": "Rikulo Stream", "version": connect.server.version};
  server.
      ..autoCompress = true;
      ..defaultResponseHeaders.chunkedTransferEncoding = true;

  connect.response
    ..headers.contentType = getContentType("json")
    ..write(JSON.encode(info));
}
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567