SollmoStudio/beyond — pull request #142 by noraesae (2014-10-22 19:28:17+00:00)
Title: Add ScriptableHttpClient.

ScriptableHttpClient is the module to send HTTP request from the Beyond
plugin. It refers to Node's SuperAgent package for its API design.

The test case is added as plugins/test/http-client.js

Moved from #139.

Basic usage is like below:

```javascript
var request = require('http-client');

// Example GET request
request
.get('http://example.org') // create GET request. It also supports post, put, delete, etc.
.query({'key': 'value'}) // query string for GET request
.set({'Key': 'value'}) // headers
.end() // execute request, return ScriptableFuture
.onSuccess(function (res) {
console.log(res.status); // Int
console.log(res.statusText); // String
console.log(res.body); // body text: String
console.log(JSON.stringify(res.headers)); // headers as object
});

// Example POST request
request
.post('http://example.org') // create POST request.
.send({'name': 'value'}) // form data
.json({'key': 'value'}) // json data
.auth('username', 'password') // auth
.end()
.onSuccess(function (res) {
console.log(res.status); // Int
console.log(res.statusText); // String
console.log(res.body); // body text: String
console.log(JSON.stringify(res.headers)); // headers as object
});
```