{host: String, port: Number}
Overrides the system proxy settings
Defines the event listener function that will handle the various states of the XMLHttpRequest. See [doc center](http://doc.wakanda.org/home2.en.html#/Wakanda Studio/0.Beta/readyState.303-867831.en.html) for more details about xhr states.
Current state of the request. See [doc center](http://doc.wakanda.org/home2.en.html#/Wakanda Studio/0.Beta/readyState.303-867831.en.html) for more details about xhr states.
Response body part (other than text).
Text response entity body.
Data type of the response ("text" or "blob").
HTTP status code of the response.
HTTP status text of the response.
Defines a XHR timeout in millisecond. Default is 0 for an infinite timeout.
Returns all HTTP headers from the response of the XMLHttprequest.
Returns the value of a specific header field in the response of the XMLHttpRequest.
Declares the HTTP method and the URL of the XMLHttpRequest.
HTTP method
URL of the request
Sends the XHR opened request.
var xhr = new XMLHttpRequest();
xhr.open( 'GET', 'http://127.0.0.1:8081/rest/$info' );
xhr.send();
See doc center for more details about upload
var xhr = new XMLHttpRequest();
xhr.open('PUT', 'http://127.0.0.1:8081/rest/$upload?$rawPict=true');
xhr.setRequestHeader( 'Content-Type', 'image/jpeg' );
xhr.onreadystatechange = function() {
if (this.readyState !== 4) {
return;
}
// Displays the upload result ID to use as reference in Wakanda DB
console.log( 'Upload ID:'+ xhr.responseText );
}
xhr.send( 'PROJECT/my-image.jpg' );
Data to send in the request body
Sends the XHR opened request.
var xhr = new XMLHttpRequest();
xhr.open( 'GET', 'http://127.0.0.1:8081/rest/$info' );
xhr.send();
See doc center for more details about upload
var myFile = new File( 'PROJECT/my-image.jpg' );
var xhr = new XMLHttpRequest();
xhr.open('PUT', 'http://127.0.0.1:8081/rest/$upload?$rawPict=true');
xhr.setRequestHeader( 'Content-Type', 'image/jpeg' );
xhr.onreadystatechange = function() {
if (this.readyState !== 4) {
return;
}
// Displays the upload result ID to use as reference in Wakanda DB
console.log( 'Upload ID:'+ xhr.responseText );
}
xhr.send( myFile );
Data to send in the request body
Allows the request to be authenticated on the remote server with a client certificate, when necessary.
Path to the PEM format private key
Path to the local PEM format certificate
Set the value of a specific header field of the XMLHttpRequest.
var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://127.0.0.1:8081/rest/$info');
xhr.setRequestHeader('X-Test', 'one');
xhr.setRequestHeader('X-Test', 'two');
xhr.send();
The header field name
The header field value
Creates a XMLHttpRequest (XHR).
var xhr = new XMLHttpRequest(); // XHR event handler. xhr.onreadystatechange = function() { // Get xhr states var state = this.readyState; // Only consider the "done" state. Skip others if (state !== 4) { return; } // Get xhr response headers var headers = this.getAllResponseHeaders(); // Get xhr response text contents var result = this.responseText; // Display the result when received console.log( result ); }; // Get server rest info // Synchronous xhr request xhr.open( 'GET', 'http://127.0.0.1:8081/rest/$info' ); // Send the XHR request xhr.send();
Sends synchronous XHR request.