Update https.js
This commit is contained in:
parent
9ea3d8d985
commit
f35a8a4714
|
@ -11,12 +11,12 @@ export function get(url, options = {}, callback) {
|
|||
|
||||
callback(emitter);
|
||||
|
||||
if(!options.encoding)
|
||||
options['encoding'] = "binary";
|
||||
if(options && !options.encoding)
|
||||
options.encoding = "binary";
|
||||
|
||||
Remote.https.get(url, options, (error, res, body) => {
|
||||
if (error) return emitter.emit("error", error);
|
||||
emitter.emit("data", new Buffer(Buffer.from(body, "binary")));
|
||||
emitter.emit("data", options && options.encoding === "binary" ? new Buffer(Buffer.from(body, "binary")) : body);
|
||||
emitter.emit("end", res);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue