Update https.js
This commit is contained in:
parent
3b9ad9b75b
commit
ea1f96c8ec
|
@ -4,16 +4,19 @@ import Remote from "./remote";
|
|||
export function get(url, options = {}, callback) {
|
||||
if (typeof(options) === "function") {
|
||||
callback = options;
|
||||
options = null;
|
||||
options = {};
|
||||
}
|
||||
|
||||
const emitter = new EventEmitter();
|
||||
|
||||
callback(emitter);
|
||||
|
||||
if(!options.encoding)
|
||||
options['encoding'] = "binary";
|
||||
|
||||
Remote.https.get(url, options, (error, res, body) => {
|
||||
if (error) return emitter.emit("error", error);
|
||||
emitter.emit("data", body);
|
||||
emitter.emit("data", new Buffer(Buffer.from(body,"binary")));
|
||||
emitter.emit("end", res);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue