elderwand 0.1.67 → 0.1.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/utils/utils.js
CHANGED
|
@@ -208,7 +208,7 @@ exports.doRequest = function(options, http, cb){
|
|
|
208
208
|
|
|
209
209
|
if(options.method != "GET"){
|
|
210
210
|
if(options.encodingType == "json"){
|
|
211
|
-
post_data = Buffer
|
|
211
|
+
post_data = new Buffer(JSON.stringify(options.postData), "utf-8");
|
|
212
212
|
options.headers['Content-Length'] = post_data.length;
|
|
213
213
|
options.headers['Content-Type'] = "application/json";
|
|
214
214
|
|
|
@@ -217,12 +217,11 @@ exports.doRequest = function(options, http, cb){
|
|
|
217
217
|
options.headers['Content-Length'] = post_data.length;
|
|
218
218
|
|
|
219
219
|
}else{
|
|
220
|
-
post_data =
|
|
220
|
+
post_data = querystring.stringify(options.postData);
|
|
221
221
|
options.headers['Content-Length'] = post_data.length;
|
|
222
222
|
options.headers['Content-Type'] = "application/x-www-form-urlencoded; charset=UTF-8";
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
|
-
//EWLog(options)
|
|
226
225
|
var req = http.request(options, function(res){
|
|
227
226
|
res.setEncoding(options.encoding);
|
|
228
227
|
var data = '';
|
|
@@ -238,7 +237,11 @@ exports.doRequest = function(options, http, cb){
|
|
|
238
237
|
});
|
|
239
238
|
});
|
|
240
239
|
if(options.method != "GET"){
|
|
241
|
-
|
|
240
|
+
if(options.encodingType == "binary"){
|
|
241
|
+
req.write(post_data,'binary');
|
|
242
|
+
}else{
|
|
243
|
+
var ret = req.write(post_data, "utf-8");
|
|
244
|
+
}
|
|
242
245
|
}
|
|
243
246
|
|
|
244
247
|
req.on('error', function(e) {
|
|
@@ -256,6 +259,7 @@ exports.doRequest = function(options, http, cb){
|
|
|
256
259
|
};
|
|
257
260
|
|
|
258
261
|
|
|
262
|
+
|
|
259
263
|
exports.createHttpPostOptions = function(url, parameters, data){
|
|
260
264
|
var options = {
|
|
261
265
|
socksPort: 9050, // Tor
|