Skip to content

Instantly share code, notes, and snippets.

@chechedotmx

chechedotmx/gist:5696213

Last active Dec 18, 2015
Embed
What would you like to do?
Simple way to request blitline from azure mobile services or nodejs, without getting 411 errors, and string not matched
var foo = function() {
return {
sendHttpPostToBlitline : function(job_data, callBackBitline) {
var http = require('http');
var json_job_data = new Object();
json_job_data.json = job_data;
var job_data_stringified = JSON.stringify(json_job_data);
var options = {
host : 'api.blitline.com',
port : 80,
method : "POST",
path : '/job',
headers : {
'Content-Type' : 'application/json',
'Content-Length' : job_data_stringified.length
}
};
console.log("Submitting to Blitline size(" + job_data_stringified.length + ") Job Data :" + job_data_stringified);
var req = http.request(options, callBackBitline);
req.write(job_data_stringified);
req.end();
}
}
}();
//Using this
foo.sendHttpPostToBlitline(job_data,callBackBitline);
//Where job_data is the blitline request javascript object and callbackblitline is the return function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment