Sample code for 30+ languages & platforms
React Native

Example: Http.QuickGetSb method

Demonstrates the QuickGetSb method.

Chilkat React Native Downloads

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

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

  // Send the HTTP GET and return the content in a StringBuilder
  const sb = new StringBuilder();
  try {
    await http.quickGetSbAsync('https://www.chilkatsoft.com/helloWorld.json', sb);
  } catch {
    if (http.lastStatus === 0) {
      // Communications error.  We did not get a response.
      console.log(http.lastErrorText);
    } else {
      console.log(`Response status code: ${http.lastStatus}`);
      console.log('Response body error text:');
      console.log(sb.getAsString());
    }

    return;
  }

  // The downloaded content:
  console.log(sb.getAsString());
  console.log('Success');
}