rafale
Version:
Deploy every services, everywhere, in just a few seconds
1 lines • 645 B
JavaScript
function httpUtil(t){this.httpReq=function(n,e,o,r){var p="";n.data&&(p=n.data),r||(r="utf8"),n.path=encodeURI(n.path);var i=t.request(n);i.on("error",function(t){e(t)}),i.on("response",function(t){var n="";t.on("data",function(t){n+=t.toString(r)}),t.on("end",function(){o(n)})}),i.end(p)},this.httpReqPipe=function(n,e,o,r){var p="";n.data&&(p=n.data),n.path=encodeURI(n.path);var i=t.request(n);i.on("error",function(t){e(t)}),i.on("response",function(t){o&&o(t),t.on("end",function(){r&&r()})}),i.end(p)}}var http=require("http"),https=require("https");module.exports.httpUtil=new httpUtil(http),module.exports.httpsUtil=new httpUtil(https);