A destructor is present on this object, but not explicitly documented in the source.
Aborts this request.
Set to true to gzip the request body when sending to the server. This is often not supported, and thus turned off by default.
Sends now and waits for the request to finish, returning the response.
Sends the request asynchronously.
Maximum number of redirections to follow (used only if followLocation is set to true). Will resolve with an error if a single request has more than this number of redirections. The default value is currently 10, but may change without notice. If you need a specific value, be sure to call this function.
Sets the timeout from inactivity on the request. This is the amount of time that passes with no send or receive activity on the request before it fails with "request timed out" error.
Waits for the request to finish or timeout, whichever comes first.
This is made public for rudimentary event loop integration, but is still basically an internal detail. Try not to use it if you have another way.
Changes the limit of number of open, inactive sockets. Reusing connections can provide a significant performance improvement, but the operating system can also impose a global limit on the number of open sockets and/or files that you don't want to run into. This lets you choose a balance right for you.
Final url after any redirections
Automatically follow a redirection?
Called when data is received. Check the state to see what data is available.
Proxy to use for this request. It should be a URL or null.
Set to true to automatically retain cookies in the associated HttpClient from this request. Note that you must have constructed the request from a HttpClient or at least passed one into the constructor for this to have any effect.
For https connections, if this is true, it will fail to connect if the TLS certificate can not be verified. Setting this to false will skip this check and allow the connection to continue anyway.
auto request = new HttpRequest(); // note that when there's no associated client, some features may not work // normally you'd instead do `new HttpClient(); client.request(...)` // set any properties here // synchronous usage auto reply = request.perform(); // async usage, type 1: request.send(); request2.send(); // wait until the first one is done, with the second one still in-flight auto response = request.waitForCompletion(); // async usage, type 2: request.onDataReceived = (HttpRequest hr) { if(hr.state == HttpRequest.State.complete) { // use hr.responseData } }; request.send(); // send, using the callback // before terminating, be sure you wait for your requests to finish! request.waitForCompletion();
Represents a HTTP request. You usually create these through a HttpClient.