Threaded HTTP request manager. The amount of threads is controlled by server.urlThreads configuration variable.

Note: This class uses the snipe.lib.Util.urlRequest method as a base.

Methods

send (clientID:Int, url:String, method:String, params:Dynamic, responseFunc:Int ‑> String ‑> Dynamic ‑> Void, responseParams:Dynamic):Void

Makes an HTTP request in separate thread. The response will be handled in the given function.

Note: To enable HTTPS support, you will need to install hxssl library with "haxelib git hxssl https://github.com/tong/hxssl" command and insert the "-lib hxssl" line into the compilation HXML file.

Parameters:

clientID

Client ID.

url

URL string.

method

HTTP request method, "get" or "post".

params

HTTP request parameters object. If the object contains field "_postData" (String), it will be used to set POST request data. If the object contains field "_headers" (Map), it will be used to set request headers. If the object contains field "_ignoreErrors" (Bool) and it is set to true, HTTP error codes will be ignored and callback will run. Connection errors will still be considered fatal.

responseFunc

Response handler. Accepts the following arguments: client ID, HTTP response string, additional response handler parameters (responseParams)

responseParams

Additional response handler parameters.