Titanium 3.X

Titanium.Network.HTTPClient

> Titanium.Network.HTTPClient

HTTP client object that (mostly) implements the XMLHttpRequest specification.

Use Titanium.Network.createHTTPClient to create a new HTTPClient object.

An HTTPClient object is intended to be used for a single request. It may be possible to re-use an HTTPClient object, but this use case is not tested.

There are three steps in making a typical HTTP request:

  • Creating an HTTPClient object.
  • Opening the HTTPClient object.
  • Sending the request.

Before opening the request, you must define one or more callbacks to handle the HTTP response, as well as errors, progress updates, and other conditions.

The HTTPClient callbacks operate somewhat differently from other Titanium callbacks, in accordance with the XMLHttpRequest specification.

When the callbacks are invoked, the this value is set to either the original HTTPClient object itself, or a response object that holds all of the response-related properties defined for the HTTPClient object. So the callbacks can use code like this to access the response values:

httpResponse = this.responseText;
status = this.status;

Content-Type Header

When sending a POST request with the HTTP client, the Content-Type header is set automatically depending on the platform and data type sent.

On the Android and iOS platforms:

  • If you are sending a JavaScript object, the content type is set to multipart/form-data.
  • For all other data types on Android, the content type is set to application/x-www-form-urlencoded.
  • For all other data types on iOS, the content type is NOT set.

On the BlackBerry, Mobile Web and Tizen platforms, the content type is always set to application/x-www-form-urlencoded as the default.

Use the setRequestHeader method to override the default Content-Type header.

Asynchronous vs. Synchronous HTTP Requests

By default, the HTTPClient makes asynchronous requests. Asynchronous requests do not block the application and use callbacks to process responses when they are received.

Synchronous requests block the execution of the application until it receives a response. On the iOS and Mobile Web platforms, you can make synchronous requests by setting the optional async parameter to false when calling the open method.

The Android platform does not support synchronous requests.

Android Platform Implementation Notes

On Android, the HTTPClient uses its own cookie store which does not share cookies with the system cookie store used by Titanium.UI.WebView. Developers can manage their cookies for both cookie stores using the methods Titanium.Network.addHTTPCookie, Titanium.Network.addSystemCookie, Titanium.Network.getHTTPCookies, Titanium.Network.getHTTPCookiesForDomain, Titanium.Network.getSystemCookies, Titanium.Network.removeHTTPCookie, Titanium.Network.removeHTTPCookiesForDomain, Titanium.Network.removeAllHTTPCookies, Titanium.Network.removeSystemCookie, Titanium.Network.removeAllSystemCookies.

Mobile Web Platform Implementation Notes

Mobile Web is limited by the same-origin policy. According to W3C: "User agents commonly apply same-origin restrictions to network requests. These restrictions prevent a client-side Web application running from one origin from obtaining data retrieved from another origin, and also limit unsafe HTTP requests that can be automatically launched toward destinations that differ from the running application's origin." This means that browsers cannot request information from a domain that the app itself does not reside on. If you are hosting the app at foo.example.com, then requests to any domain other than *.example.com will fail.

There are two solutions to get around this problem:

  • Configure the destination server to support Cross-Origin Resource Sharing.
  • Use Ti.Network.httpURLFormatter in conjunction with a proxy on the server hosting the application.

If you use a proxy, be sure to properly configure how cookies are passed through. You may not want cookies proxied to third parties that could identify a user.

More information about Cross-Origin Resource Sharing can be found on the W3C Cross-Origin Resource Sharing specification page.

Example

Simple GET Request

The following code excerpt does a simple GET request and logs the response text.

 var url = "http://www.appcelerator.com";
 var client = Ti.Network.createHTTPClient({
     // function called when the response data is available
     onload : function(e) {
         Ti.API.info("Received text: " + this.responseText);
         alert('success');
     },
     // function called when an error occurs, including a timeout
     onerror : function(e) {
         Ti.API.debug(e.error);
         alert('error');
     },
     timeout : 5000  // in milliseconds
 });
 // Prepare the connection.
 client.open("GET", url);
 // Send the request.
 client.send();

  • 0.1
  • 3.1.2
  • 0.1
  • 0.1
  • 1.8
  • 3.1
Defined By

Properties

Titanium.Network.HTTPClient
DONE : Numberreadonly

Ready state constant indicating that the request is complete.

Ready state constant indicating that the request is complete.

In this ready state, either the data has been transferred, or an error has occured.

See also readyState.

Titanium.Network.HTTPClient
HEADERS_RECEIVED : Numberreadonly

Ready state constant indicating that response headers have been received.

Ready state constant indicating that response headers have been received.

See also readyState.

Titanium.Network.HTTPClient
LOADING : Numberreadonly

Ready state constant indicating that response data is being received from the remote server.

Ready state constant indicating that response data is being received from the remote server.

See also readyState.

Titanium.Network.HTTPClient
OPENED : Numberreadonly

Ready state constant indicating that the connection has been opened, but the request has not yet been sent.

Ready state constant indicating that the connection has been opened, but the request has not yet been sent.

See also readyState.

Titanium.Network.HTTPClient
UNSENT : Numberreadonly

Ready state constant indicating that HTTPClient request has not been opened or sent.

Ready state constant indicating that HTTPClient request has not been opened or sent.

See also readyState.

Titanium.Network.HTTPClient
allResponseHeaders : Stringreadonly

All of the response headers.

All of the response headers.

Contains a single string, or an empty string if no headers are available.

See also: getResponseHeader.

  • 0.1
apiName : Stringreadonly

The name of the API that this proxy corresponds to.

The name of the API that this proxy corresponds to.

The value of this property is the fully qualified name of the API. For example, Button returns Ti.UI.Button.

  • 3.2
  • 3.2
  • 3.2
  • 3.2
  • 3.2
  • 3.2
Titanium.Network.HTTPClient
: Boolean
Determines whether automatic encoding is enabled for the specified URL. ...

Determines whether automatic encoding is enabled for the specified URL.

Set to false to disable automatic URL-encoding.

Default: true

  • 0.1
Titanium.Network.HTTPClient
: Boolean
Determines whether automatic automatic handling of HTTP redirects is enabled. ...

Determines whether automatic automatic handling of HTTP redirects is enabled.

Set to false to disable automatic HTTP redirects handling.

Default: true

  • 0.1
  • 0.1
  • 0.1
Indicates if the proxy will bubble an event to its parent. ...

Indicates if the proxy will bubble an event to its parent.

Some proxies (most commonly views) have a relationship to other proxies, often established by the add() method. For example, for a button added to a window, a click event on the button would bubble up to the window. Other common parents are table sections to their rows, table views to their sections, and scrollable views to their views. Set this property to false to disable the bubbling to the proxy's parent.

Default: true

  • 3.0
  • 3.0
  • 3.0
Titanium.Network.HTTPClient
: Boolean
Determines whether HTTP responses are cached. ...

Determines whether HTTP responses are cached.

If cache is set to true, requests using this HTTP client will cache their responses (respecting headers such as "no-cache", "no-store", and cache expiry). In this case, repeated requests to the same URL may retrieve the initial response rather than triggering a new request. The cache is shared between all instances of HTTPClient.

Caching should only be enabled for HTTP requests which you expect the result to remain consistent for.

If cache is false, any request on this HTTP client will result in a new HTTP request.

This propery must be set before open is called.

Default: false

  • 2.0
  • 2.0
Titanium.Network.HTTPClient
connected : Booleanreadonly

Indicates whether the response was successful.

Indicates whether the response was successful.

Titanium.Network.HTTPClient
connectionType : Stringreadonly

Connection type, normally either GET or POST.

Connection type, normally either GET or POST.

Titanium.Network.HTTPClient
: String
Sets the domain parameter for authentication credentials. ...

Sets the domain parameter for authentication credentials.

Set this parameter when authentication against NTLM domains along with the username and password properties. iOS supports NTLM authentication natively. Android can be extended using the addAuthFactory method. Must be set before calling open.

Default: Undefined

  • 3.0
  • 3.0
  • 3.0
  • 3.0
Titanium.Network.HTTPClient
: Boolean
Determines whether the client should attempt to keep a persistent connection. ...

Determines whether the client should attempt to keep a persistent connection.

Set to true to maintain a persistent connection.

Default: false

  • 0.1
  • 0.1
Titanium.Network.HTTPClient
file : String

Target local file to receive data.

Target local file to receive data.

On iOS, can only be set after calling open.

On Mobile Web and Tizen, can be set anytime prior to calling send. The file must be writable such as the application data directory or temp directory.

  • 0.1
  • 0.1
  • 1.8
  • 3.1
Titanium.Network.HTTPClient
location : Stringreadonly

Absolute URL of the request.

Absolute URL of the request.

If the request redirects, this property returns the URL of the redirected request.

Titanium.Network.HTTPClient
ondatastream : Callback<Object>

Function to be called at regular intervals as the request data is being received.

Function to be called at regular intervals as the request data is being received.

Must be set before calling open.

The progress property of the event will contain a value from 0.0-1.0 with the progress of the request.

Titanium.Network.HTTPClient
onerror : Callback<FailureResponse>

Function to be called upon a error response.

Function to be called upon a error response.

Must be set before calling open.

The callback's argument is an object with a single property, error, containing the error string.

Titanium.Network.HTTPClient
onload : Callback<SuccessResponse>

Function to be called upon a successful response.

Function to be called upon a successful response.

Must be set before calling open.

To access response data and headers, access the HTTPClient object itself (accessible as this during the callback, or the source property of the callback event).

Titanium.Network.HTTPClient
onreadystatechange : Callback<Object>

Function to be called for each readyState change.

Function to be called for each readyState change.

Must be set before calling open.

When the callback is invoked, this.readyState is set to one of the Titanium.Network.HTTPClient ready-state constants, OPENED, HEADERS_RECEIVED, LOADING, or DONE.

Titanium.Network.HTTPClient
onsendstream : Callback<Object>

Function to be called at regular intervals as the request data is being transmitted.

Function to be called at regular intervals as the request data is being transmitted.

Must be set before calling open.

The progress property of the event will contain a value from 0.0-1.0 with the progress of the upload.

Titanium.Network.HTTPClient
: String
Sets the password parameter for authentication credentials. ...

Sets the password parameter for authentication credentials.

Must be set before calling open.

Default: Undefined

  • 3.0
  • 3.0
  • 3.0
  • 3.0
Titanium.Network.HTTPClient
readyState : Numberreadonly

The current ready state of this HTTP request.

The current ready state of this HTTP request.

The ready state describes the current state of the request. The ready state is set to one of the five Titanium.Network.HTTPClient ready state constants. A typical HTTP request goes through the states in this order:

The onreadystatechange callback is invoked each time the ready state changes.

Titanium.Network.HTTPClient
responseData : Titanium.Blobreadonly

Response data as a Blob object.

Response data as a Blob object.

Titanium.Network.HTTPClient
responseText : Stringreadonly

Response as text.

Response as text.

Set to null if an error was received or no data was returned.

Titanium.Network.HTTPClient
responseXML : Titanium.XML.Documentreadonly

Response object as an XML DOM Document object.

Response object as an XML DOM Document object.

Set to null if the content type returned by the server was not XML or if the content could not be parsed.

Titanium.Network.HTTPClient
status : Numberreadonly

Response HTTP status code.

Response HTTP status code.

Titanium.Network.HTTPClient
statusText : Stringreadonly

Human-readable status message associated with the status code.

Human-readable status message associated with the status code.

Titanium.Network.HTTPClient
timeout : Number

Timeout in milliseconds when the connection should be aborted.

Timeout in milliseconds when the connection should be aborted.

On Mobile Web and Tizen, the timeout only works when making asynchronous requests.

Titanium.Network.HTTPClient
: Number
Sets the TLS version to use for handshakes. ...

Sets the TLS version to use for handshakes.

If you experience handshake failures, set this value to a lower version using the TLS constants in Titanium.Network. 'undefined', 'null', or unsupported values use the default behavior for that iOS version.

Default: undefined. For iOS 4, this is effectively TLS_VERSION_1_0. For iOS 5 and greater, this is TLS_VERSION_1_2.

  • 1.8
  • 1.8
Titanium.Network.HTTPClient
: String
Sets the username parameter for authentication credentials. ...

Sets the username parameter for authentication credentials.

Must be set before calling open.

Default: Undefined

  • 3.0
  • 3.0
  • 3.0
  • 3.0
Titanium.Network.HTTPClient
: Boolean
Determines how SSL certification validation is performed on connection. ...

Determines how SSL certification validation is performed on connection.

On Android, this property is ignored if the addKeyManager or addTrustManager methods are used to create a custom SSL context.

Default: False when running in the simulator or on device in testing mode, and true if built for release in distribution mode.

  • 0.1
  • 0.1
  • 0.1
Titanium.Network.HTTPClient
: Boolean
Determines whether the request should include any cookies and HTTP authentication information. ...

Determines whether the request should include any cookies and HTTP authentication information.

Set to true to include cookies and HTTP authentication information with the request.

This property must be set before open() is called. Setting this to true will force the request to be asynchronous.

Default: false

  • 1.8
  • 3.1
Defined By

Methods

Titanium.Network.HTTPClient
( ) : void
Cancels a pending request. ...

Cancels a pending request.

Returns

  • void
Titanium.Network.HTTPClient
( scheme, factory ) : void
Registers a new AuthSchemeFactory for a given scheme. ...

Registers a new AuthSchemeFactory for a given scheme.

Use this method to add support for authorization schemes not natively supported by Android.

  • 3.0
  • 3.1.2

Parameters

  • scheme : String

    The authentication scheme.

  • factory : Object

    The authentication factory. This factory must implement the AuthSchemeFactory interface.

Returns

  • void
( name, callback ) : void
Adds the specified callback as an event listener for the named event. ...

Adds the specified callback as an event listener for the named event.

Parameters

  • name : String

    Name of the event.

  • callback : Callback<Object>

    Callback function to invoke when the event is fired.

Returns

  • void
Titanium.Network.HTTPClient
( X509KeyManager ) : void
Adds a custom key manager. ...

Adds a custom key manager.

Use this method to add support for X.509 certifcate-base keypairs.

If this method is used to create a custom SSLContext, the validatesSecureCertificate property is ignored.

  • 3.1

Parameters

  • X509KeyManager : Object

    X.509 key manager. This key manager must implement the X509KeyManager inteface.

Returns

  • void
Titanium.Network.HTTPClient
( X509TrustManager ) : void
Adds a custom trust manager. ...

Adds a custom trust manager.

Use this method to add support for X.509 certifcates.

If this method is used to create a custom SSLContext, the validatesSecureCertificate property is ignored.

  • 3.1

Parameters

  • X509TrustManager : Object

    X.509 trust manager. This trust manager must implement the X509TrustManager inteface.

Returns

  • void
Applies the properties to the proxy. ...

Applies the properties to the proxy.

Properties are supplied as a dictionary. Each key-value pair in the object is applied to the proxy such that myproxy[key] = value.

  • 3.0
  • 3.0
  • 3.0

Parameters

  • props : Dictionary

    A dictionary of properties to apply.

Returns

  • void
Titanium.Network.HTTPClient
( host ) : void
Clears any cookies stored for the host. ...

Clears any cookies stored for the host.

  • 0.1
  • 0.1
  • 0.1

Parameters

  • host : String

    The URL of the host/domain to clear cookies for.

Returns

  • void
( name, event ) : void
Fires a synthesized event to any registered listeners. ...

Fires a synthesized event to any registered listeners.

Parameters

  • name : String

    Name of the event.

  • event : Dictionary

    A dictionary of keys and values to add to the Titanium.Event object sent to the listeners.

Returns

  • void
Titanium.Network.HTTPClient
( ) : String
Gets the value of the allResponseHeaders property. ...

Gets the value of the allResponseHeaders property.

  • 0.1

Returns

  • String
Gets the value of the apiName property. ...

Gets the value of the apiName property.

  • 3.2
  • 3.2
  • 3.2
  • 3.2
  • 3.2
  • 3.2

Returns

  • String
Titanium.Network.HTTPClient
( ) : Boolean
Gets the value of the autoEncodeUrl property. ...

Gets the value of the autoEncodeUrl property.

  • 0.1

Returns

  • Boolean
Titanium.Network.HTTPClient
( ) : Boolean
Gets the value of the autoRedirect property. ...

Gets the value of the autoRedirect property.

  • 0.1
  • 0.1
  • 0.1

Returns

  • Boolean
Gets the value of the bubbleParent property. ...

Gets the value of the bubbleParent property.

  • 3.0
  • 3.0
  • 3.0

Returns

  • Boolean
Titanium.Network.HTTPClient
( ) : Boolean
Gets the value of the cache property. ...

Gets the value of the cache property.

  • 2.0
  • 2.0

Returns

  • Boolean
Titanium.Network.HTTPClient
( ) : Boolean
Gets the value of the connected property. ...

Gets the value of the connected property.

Returns

  • Boolean
Titanium.Network.HTTPClient
( ) : String
Gets the value of the connectionType property. ...

Gets the value of the connectionType property.

Returns

  • String
Titanium.Network.HTTPClient
( ) : String
Gets the value of the domain property. ...

Gets the value of the domain property.

  • 3.0
  • 3.0
  • 3.0
  • 3.0

Returns

  • String
Titanium.Network.HTTPClient
( ) : Boolean
Gets the value of the enableKeepAlive property. ...

Gets the value of the enableKeepAlive property.

  • 0.1
  • 0.1

Returns

  • Boolean
Titanium.Network.HTTPClient
( ) : String
Gets the value of the file property. ...

Gets the value of the file property.

  • 0.1
  • 0.1
  • 1.8
  • 3.1

Returns

  • String
Titanium.Network.HTTPClient
( ) : String
Gets the value of the location property. ...

Gets the value of the location property.

Returns

  • String
Titanium.Network.HTTPClient
( ) : Callback<Object>
Gets the value of the ondatastream property. ...

Gets the value of the ondatastream property.

Returns

  • Callback<Object>
Titanium.Network.HTTPClient
( ) : Callback<FailureResponse>
Gets the value of the onerror property. ...

Gets the value of the onerror property.

Returns

Titanium.Network.HTTPClient
( ) : Callback<SuccessResponse>
Gets the value of the onload property. ...

Gets the value of the onload property.

Returns

Titanium.Network.HTTPClient
( ) : Callback<Object>
Gets the value of the onreadystatechange property. ...

Gets the value of the onreadystatechange property.

Returns

  • Callback<Object>
Titanium.Network.HTTPClient
( ) : Callback<Object>
Gets the value of the onsendstream property. ...

Gets the value of the onsendstream property.

Returns

  • Callback<Object>
Titanium.Network.HTTPClient
( ) : String
Gets the value of the password property. ...

Gets the value of the password property.

  • 3.0
  • 3.0
  • 3.0
  • 3.0

Returns

  • String
Titanium.Network.HTTPClient
( ) : Number
Gets the value of the readyState property. ...

Gets the value of the readyState property.

Returns

  • Number
Titanium.Network.HTTPClient
( ) : Titanium.Blob
Gets the value of the responseData property. ...

Gets the value of the responseData property.

Returns

Titanium.Network.HTTPClient
( name ) : String
Returns the value of the specified response header. ...

Returns the value of the specified response header.

Parameters

  • name : String

    Name of the header to retrieve.

Returns

  • String
Titanium.Network.HTTPClient
( ) : String
Gets the value of the responseText property. ...

Gets the value of the responseText property.

Returns

  • String
Titanium.Network.HTTPClient
( ) : Titanium.XML.Document
Gets the value of the responseXML property. ...

Gets the value of the responseXML property.

Returns

Titanium.Network.HTTPClient
( ) : Number
Gets the value of the status property. ...

Gets the value of the status property.

Returns

  • Number
Titanium.Network.HTTPClient
( ) : String
Gets the value of the statusText property. ...

Gets the value of the statusText property.

Returns

  • String
Titanium.Network.HTTPClient
( ) : Number
Gets the value of the timeout property. ...

Gets the value of the timeout property.

Returns

  • Number
Titanium.Network.HTTPClient
( ) : Number
Gets the value of the tlsVersion property. ...

Gets the value of the tlsVersion property.

  • 1.8
  • 1.8

Returns

  • Number
Titanium.Network.HTTPClient
( ) : String
Gets the value of the username property. ...

Gets the value of the username property.

  • 3.0
  • 3.0
  • 3.0
  • 3.0

Returns

  • String
Titanium.Network.HTTPClient
( ) : Boolean
Gets the value of the validatesSecureCertificate property. ...

Gets the value of the validatesSecureCertificate property.

  • 0.1
  • 0.1
  • 0.1

Returns

  • Boolean
Titanium.Network.HTTPClient
( ) : Boolean
Gets the value of the withCredentials property. ...

Gets the value of the withCredentials property.

  • 1.8
  • 3.1

Returns

  • Boolean
Titanium.Network.HTTPClient
( method, url, [async] ) : void
Opens the request and prepares the connection. ...

Opens the request and prepares the connection.

Parameters

  • method : String

    HTTP method for this request, such as 'GET' or 'POST'.

  • url : String

    URL for the request.

  • async : Boolean (optional)

    Determines whether the request should be made asynchronously. Only used on iOS, Mobile Web and Tizen.

    Default: True

Returns

  • void
( name, callback ) : void
Removes the specified callback as an event listener for the named event. ...

Removes the specified callback as an event listener for the named event.

Multiple listeners can be registered for the same event, so the callback parameter is used to determine which listener to remove.

When adding a listener, you must save a reference to the callback function in order to remove the listener later:

var listener = function() { Ti.API.info("Event listener called."); }
window.addEventListener('click', listener);

To remove the listener, pass in a reference to the callback function:

window.removeEventListener('click', listener);

Parameters

  • name : String

    Name of the event.

  • callback : Callback<Object>

    Callback function to remove. Must be the same function passed to addEventListener.

Returns

  • void
Titanium.Network.HTTPClient
( [data] ) : void
Sends the request. ...

Sends the request.

For POST requests, use the data parameter to send POST data.

If you pass a serializable JavaScript object, it is automatically turned into form-encoded POST data. You can also send an arbitrary string or binary data (in the form of a Titanium.Blob).

To send array data, specify each array element individually as a property of the object. For example, normally, you specify an array in an object as:

var payload = { myArray: [1, 2, 3] };

Instead, for the HTTP client to encode the data correctly, you need to send the data as:

var payload = {
    "myArray[0]" : 1,
    "myArray[1]" : 2,
    "myArray[2]" : 3
};

On iOS, you can specify a synchronous request when you call open by passing false for the async parameter. In the case of a synchronous request, send blocks until the request is complete.

Parameters

Returns

  • void
Titanium.Network.HTTPClient
( autoEncodeUrl ) : void
Sets the value of the autoEncodeUrl property. ...

Sets the value of the autoEncodeUrl property.

  • 0.1

Parameters

  • autoEncodeUrl : Boolean

    New value for the property.

Returns

  • void
Titanium.Network.HTTPClient
( autoRedirect ) : void
Sets the value of the autoRedirect property. ...

Sets the value of the autoRedirect property.

  • 0.1
  • 0.1
  • 0.1

Parameters

  • autoRedirect : Boolean

    New value for the property.

Returns

  • void
( bubbleParent ) : void
Sets the value of the bubbleParent property. ...

Sets the value of the bubbleParent property.

  • 3.0
  • 3.0
  • 3.0

Parameters

  • bubbleParent : Boolean

    New value for the property.

Returns

  • void
Titanium.Network.HTTPClient
( cache ) : void
Sets the value of the cache property. ...

Sets the value of the cache property.

  • 2.0
  • 2.0

Parameters

  • cache : Boolean

    New value for the property.

Returns

  • void
Titanium.Network.HTTPClient
( domain ) : void
Sets the value of the domain property. ...

Sets the value of the domain property.

  • 3.0
  • 3.0
  • 3.0
  • 3.0

Parameters

  • domain : String

    New value for the property.

Returns

  • void
Titanium.Network.HTTPClient
( enableKeepAlive ) : void
Sets the value of the enableKeepAlive property. ...

Sets the value of the enableKeepAlive property.

  • 0.1
  • 0.1

Parameters

  • enableKeepAlive : Boolean

    New value for the property.

Returns

  • void
Titanium.Network.HTTPClient
( file ) : void
Sets the value of the file property. ...

Sets the value of the file property.

  • 0.1
  • 0.1
  • 1.8
  • 3.1

Parameters

  • file : String

    New value for the property.

Returns

  • void
Titanium.Network.HTTPClient
( ondatastream ) : void
Sets the value of the ondatastream property. ...

Sets the value of the ondatastream property.

Parameters

  • ondatastream : Callback<Object>

    New value for the property.

Returns

  • void
Titanium.Network.HTTPClient
( onerror ) : void
Sets the value of the onerror property. ...

Sets the value of the onerror property.

Parameters

Returns

  • void
Titanium.Network.HTTPClient
( onload ) : void
Sets the value of the onload property. ...

Sets the value of the onload property.

Parameters

Returns

  • void
Titanium.Network.HTTPClient
( onreadystatechange ) : void
Sets the value of the onreadystatechange property. ...

Sets the value of the onreadystatechange property.

Parameters

  • onreadystatechange : Callback<Object>

    New value for the property.

Returns

  • void
Titanium.Network.HTTPClient
( onsendstream ) : void
Sets the value of the onsendstream property. ...

Sets the value of the onsendstream property.

Parameters

  • onsendstream : Callback<Object>

    New value for the property.

Returns

  • void
Titanium.Network.HTTPClient
( password ) : void
Sets the value of the password property. ...

Sets the value of the password property.

  • 3.0
  • 3.0
  • 3.0
  • 3.0

Parameters

  • password : String

    New value for the property.

Returns

  • void
Titanium.Network.HTTPClient
( name, value ) : void
Sets the value for the specified request header. ...

Sets the value for the specified request header. Must be called after open but before send.

Parameters

  • name : String

    Name of the header to set.

  • value : String

    Value to assign to the header. May be null to clear a default header value, such as X-Requested-With.

Returns

  • void
Titanium.Network.HTTPClient
( timeout ) : void
Sets the request timeout. ...

Sets the request timeout.

On Mobile Web and Tizen, the timeout only works when making asynchronous requests.

Parameters

  • timeout : Number

    Timeout in milliseconds.

Returns

  • void
Titanium.Network.HTTPClient
( tlsVersion ) : void
Sets the value of the tlsVersion property. ...

Sets the value of the tlsVersion property.

  • 1.8
  • 1.8

Parameters

  • tlsVersion : Number

    New value for the property.

Returns

  • void
Titanium.Network.HTTPClient
( username ) : void
Sets the value of the username property. ...

Sets the value of the username property.

  • 3.0
  • 3.0
  • 3.0
  • 3.0

Parameters

  • username : String

    New value for the property.

Returns

  • void
Titanium.Network.HTTPClient
( validatesSecureCertificate ) : void
Sets the value of the validatesSecureCertificate property. ...

Sets the value of the validatesSecureCertificate property.

  • 0.1
  • 0.1
  • 0.1

Parameters

  • validatesSecureCertificate : Boolean

    New value for the property.

Returns

  • void
Titanium.Network.HTTPClient
( withCredentials ) : void
Sets the value of the withCredentials property. ...

Sets the value of the withCredentials property.

  • 1.8
  • 3.1

Parameters

  • withCredentials : Boolean

    New value for the property.

Returns

  • void