https-client

A simple http client based on standard haxe.Http to handle Rest call.


Keywords
client, http
License
GPL-2.0+
Install
haxelib install https-client 0.1.0

Documentation

Haxe http client

A simple http client based on standard haxe.Http to handle Rest call.

Theoretically support all sys target, but was tested only in php.

Usage Exemple

Json POST Request

  var request = new HttpRequest();
  request.method = "POST";
  request.url = new Url("http://localhost");
  request.headers.set("Content-Type", "application/json");
  request.data = "{test: 'Valeur'}";
  request.send({
    onData: function (data : String) {
        trace(data);
    },
    onError: function (error : String, ?data : String) {
        trace(error);
    },
    onStatus: function (code : Int) {
        trace("Status " + code);
    }
  });

Html Post/Get

For convenience there is two utils function to create post and get with parameter

    var request = HttpRequest.createGetRequest("http://http.localhost.com/hello.txt", {[
      {
        name: "param1",
        value: "value1",
      },
      {
        name: "param2",
        value: "value2",
      }
    ]);
    //If post request the data attribute is initilised with parameters
    //If get request the url is initialised with parameters
    request.send(callbacks);

Todo

  • Multipart
  • Proxy
  • Targe flash, js