Sample code for 30+ languages & platforms
React Native

Setting a HTTP Max Response Size

Demonstrates the MaxResponseSize property.

Chilkat React Native Downloads

React Native
import { Http } from '@chilkat/react-native'

async function chilkatExample() {
  const http = new Http();

  const maxSz = 16384;
  http.maxResponseSize = maxSz;

  // Try to get something larger, such as hamlet.xml which is 279658 bytes
  let xmlStr: string;
  try {
    xmlStr = await http.quickGetStrAsync('https://chilkatsoft.com/hamlet.xml');
  } catch {
    // 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.
    console.log(http.lastErrorText);
    return;
  }

  console.log('OK');
}