mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-07 14:18:47 +00:00
handle proxying binary data
This commit is contained in:
parent
2de82795c7
commit
a7dd6d965d
1 changed files with 6 additions and 6 deletions
|
@ -4,14 +4,14 @@ import http from "http";
|
|||
export function httpsRequest(url, params) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var request = https.request(url, params, function (response) {
|
||||
let data = "";
|
||||
var data = [];
|
||||
|
||||
response.on("data", (chunk) => {
|
||||
data = data + chunk.toString();
|
||||
data.push(chunk);
|
||||
});
|
||||
|
||||
response.on("end", () => {
|
||||
resolve([response.statusCode, response.headers["content-type"], data]);
|
||||
resolve([response.statusCode, response.headers["content-type"], Buffer.concat(data)]);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -26,14 +26,14 @@ export function httpsRequest(url, params) {
|
|||
export function httpRequest(url, params) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var request = http.request(url, params, function (response) {
|
||||
let data = "";
|
||||
var data = [];
|
||||
|
||||
response.on("data", (chunk) => {
|
||||
data = data + chunk.toString();
|
||||
data.push(chunk);
|
||||
});
|
||||
|
||||
response.on("end", () => {
|
||||
resolve([response.statusCode, response.headers["content-type"], data]);
|
||||
resolve([response.statusCode, response.headers["content-type"], Buffer.concat(data)]);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue