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?
How to gzip the output in Rikulo Stream?
144 Views Asked by alamoos At
2
There are 2 best solutions below
0
On
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));
}
You can configure it at startup as follows: