Dart
Dart
Setting a HTTP Max Response Size
Demonstrates theMaxResponseSize property.
Chilkat Dart Downloads
import 'package:chilkat/chilkat.dart';
void main() {
final http = CkHttp();
final maxSz = 16384;
http.maxResponseSize = maxSz;
// Try to get something larger, such as hamlet.xml which is 279658 bytes
final String xmlStr;
try {
xmlStr = http.quickGetStr('https://chilkatsoft.com/hamlet.xml');
} on ChilkatException catch (e) {
// If the LastErrorText contains the string "MaxResponseSize",
// then the HTTP request failed because the response body would've been larger than the max allowed response size.
print(e.lastErrorText);
return;
}
print('OK');
}