React Native
React Native
Demonstrate HttpRequest.RemoveAllParams
Demonstrates the effect of calling HttpRequest.RemoveAllParams.Chilkat React Native Downloads
import { HttpRequest } from '@chilkat/react-native'
function chilkatExample() {
const req = new HttpRequest();
req.httpVerb = 'POST';
req.path = '/test123';
req.contentType = 'application/x-www-form-urlencoded';
req.addParam('paramA', 'AAA');
req.addParam('paramB', 'BBB');
req.addParam('paramC', 'CCC');
console.log(req.generateRequestText());
console.log('---------------');
// Generates:
// POST /test123 HTTP/1.1
// Content-Type: application/x-www-form-urlencoded
// Host: domain
// Content-Length: 32
//
// paramA=AAA¶mB=BBB¶mC=CCC
//
// If we call RemoveAllParams, and then add some additional params,
// then the original params are gone, and only the new params exist.
req.removeAllParams();
req.addParam('paramD', 'DDD');
req.addParam('paramE', 'EEE');
req.addParam('paramF', 'FFF');
console.log(req.generateRequestText());
console.log('---------------');
// Generates:
// POST /test123 HTTP/1.1
// Content-Type: application/x-www-form-urlencoded
// Host: domain
// Content-Length: 32
//
// paramD=DDD¶mE=EEE¶mF=FFF
}