io-nodejs-debug.js revision e7a8de4b7486f0890b36c9effa2703630dd6faa5
c7a0918bf9dc49db2a98ee5ec43a5e139e938f1cMatt Sweeney/*global Y: false, Buffer: false, clearInterval: false, clearTimeout: false, console: false, exports: false, global: false, module: false, process: false, querystring: false, require: false, setInterval: false, setTimeout: false, __filename: false, __dirname: false */
c7a0918bf9dc49db2a98ee5ec43a5e139e938f1cMatt Sweeney * Passthru to the NodeJS <a href="https://github.com/mikeal/request">request</a> module.
c7a0918bf9dc49db2a98ee5ec43a5e139e938f1cMatt Sweeney * This method is return of `require('request')` so you can use it inside NodeJS without
c7a0918bf9dc49db2a98ee5ec43a5e139e938f1cMatt Sweeney * the IO abstraction.
c7a0918bf9dc49db2a98ee5ec43a5e139e938f1cMatt Sweeney * @method request
c7a0918bf9dc49db2a98ee5ec43a5e139e938f1cMatt Sweeney Y.log('Loading NodeJS Request Transport', 'info', 'io');
c7a0918bf9dc49db2a98ee5ec43a5e139e938f1cMatt Sweeney NodeJS IO transport, uses the NodeJS <a href="https://github.com/mikeal/request">request</a>
c7a0918bf9dc49db2a98ee5ec43a5e139e938f1cMatt Sweeney module under the hood to perform all network IO.
c7a0918bf9dc49db2a98ee5ec43a5e139e938f1cMatt Sweeney @method transports.nodejs
c7a0918bf9dc49db2a98ee5ec43a5e139e938f1cMatt Sweeney @returns {Object} This object contains only a `send` method that accepts a
c7a0918bf9dc49db2a98ee5ec43a5e139e938f1cMatt Sweeney `transaction object`, `uri` and the `config object`.
c7a0918bf9dc49db2a98ee5ec43a5e139e938f1cMatt Sweeney method: 'PUT',
1dac070d5991af1a83315be5c43374921abe4aeaMatt Sweeney data: '?foo=bar',
1dac070d5991af1a83315be5c43374921abe4aeaMatt Sweeney //Extra request module config options.
1dac070d5991af1a83315be5c43374921abe4aeaMatt Sweeney maxRedirects: 100,
c7a0918bf9dc49db2a98ee5ec43a5e139e938f1cMatt Sweeney strictSSL: true,
c7a0918bf9dc49db2a98ee5ec43a5e139e938f1cMatt Sweeney multipart: [
c7a0918bf9dc49db2a98ee5ec43a5e139e938f1cMatt Sweeney 'content-type': 'application/json',
c7a0918bf9dc49db2a98ee5ec43a5e139e938f1cMatt Sweeney body: JSON.stringify({
'message.txt': {
var flatten = function(o) {
var str = [];
var rconf = {
if (err) {
if (data) {
transaction.c = {
responseXML: null,
getAllResponseHeaders: function() {
config.notify(((data && (data.statusCode >= 200 && data.statusCode <= 299)) ? 'success' : 'failure'), transaction, config);
var ret = {
return ret;