readBytes static method
read the whole body, but stop with 413 once it passes max bytes.
Implementation
static Future<Uint8List> readBytes(HttpRequest request, int max) async {
_checkContentLength(request, max);
BytesBuilder builder = BytesBuilder(copy: false);
await for (List<int> chunk in limit(request, max)) {
builder.add(chunk);
}
return builder.takeBytes();
}