React Native Requires Chilkat v11.0.0+
React Native
Example: Http.HttpNoBody method
Demonstrates how to use the HttpNoBody method to send HTTP requests without a request body (e.g., GET, DELETE, HEAD) and receive the response in a Chilkat Http response object.Chilkat React Native Downloads
import { Http, HttpResponse } from '@chilkat/react-native'
async function chilkatExample() {
const http = new Http();
const resp = new HttpResponse();
// Send a DELETE request to https://api.example.com/users/123
const url = 'https://api.example.com/users/123';
try {
await http.httpNoBodyAsync('DELETE', url, resp);
} catch {
console.log(http.lastErrorText);
return;
}
console.log(`Response Status Code: ${resp.statusCode}`);
console.log('Response body:');
console.log(resp.bodyStr);
}