session destroy fixed
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
const http = require('http')
|
||||
const https = require('https')
|
||||
|
||||
module.exports = class http_client {
|
||||
constructor(ip, port) {
|
||||
@@ -63,4 +64,18 @@ module.exports.get = async (options, callback_res, callback_err) => {
|
||||
}).on('error', err => {
|
||||
callback_err(err)
|
||||
})
|
||||
}
|
||||
|
||||
module.exports.gets = async (options, callback_res, callback_err) => {
|
||||
https.get(options, function(res) {
|
||||
var body_chunks = []
|
||||
res.on('data', chunk => {
|
||||
body_chunks.push(chunk)
|
||||
}).on('end', () => {
|
||||
var body = Buffer.concat(body_chunks)
|
||||
callback_res(body)
|
||||
})
|
||||
}).on('error', err => {
|
||||
callback_err(err)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user