Js ingest

Send, request logic is implemented for browser and nodejs. 
Changed 

----- Original Message -----

From: "Ali Anwar" <notifications@github.com> 
To: "caskdata/cdap-ingest" <cdap-ingest@noreply.github.com> 
Cc: "kpovetkin" <kpovetkin@cybervisiontech.com> 
Sent: Monday, October 20, 2014 10:05:28 PM 
Subject: Re: [cdap-ingest] Js ingest (#76) 



In stream-client/javascript/src/request-node.js: 
> + */
> +
> +var Fs = require('fs'),
> +    Utils = require('./utils'),
> +    Promise = require('./promise');
> +
> +var requestAsync = function requestAsync(params) {
> +        var connection = params.ssl ? require('https') : require('http');
> +
> +        if (!params.method || !params.path || !params.host || !params.port) {
> +            throw new Error('"host", "port", "method", "path" properties are required');
> +        }
> +
> +        params.ssl = (null != params.ssl) ? params.ssl : false;
> +        params.headers = params.headers || {};
> +        params.data = JSON.stringify(params.data || {}); 


In all of the other clients, when a user does StreamWriter.write("11byteslong"), simply 11 bytes get sent in the data field. However, here, 13 bytes are being sent because a string is being preceded and followed by escaped quotes, when it is stringified . 

To avoid that, don't stringify the data parameter, and expect it as a string, rather than an object. This change also makes it consistent with the StreamWriters in the other languages. 

— 
Reply to this email directly or view it on GitHub .