mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-22 05:18:00 +01:00
test ignore
This commit is contained in:
parent
88c745e892
commit
9a66aa08a7
1 changed files with 4 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
const express = require("express");
|
const express = require("express");
|
||||||
const fetch = require("node-fetch");
|
const fetch = require("node-fetch");
|
||||||
const { URL } = require("url");
|
const { URL } = require("url");
|
||||||
|
const { Readable } = require("node:stream");
|
||||||
|
|
||||||
// Array of hostnames that will be proxied
|
// Array of hostnames that will be proxied
|
||||||
const URL_WHITELIST = [
|
const URL_WHITELIST = [
|
||||||
|
@ -58,6 +59,8 @@ app.use(function (req, res, next) {
|
||||||
* @param {express.Response} res
|
* @param {express.Response} res
|
||||||
*/
|
*/
|
||||||
const proxy = async (req, res) => {
|
const proxy = async (req, res) => {
|
||||||
|
const { fetch } = await import("undici")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let url;
|
let url;
|
||||||
|
|
||||||
|
@ -80,7 +83,7 @@ const proxy = async (req, res) => {
|
||||||
method: req.method,
|
method: req.method,
|
||||||
});
|
});
|
||||||
|
|
||||||
f.body.pipe(res);
|
Readable.fromWeb(f.body).pipe(res);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(`==> Error: ${e}`);
|
console.log(`==> Error: ${e}`);
|
||||||
res.status(500).send("Internal server error");
|
res.status(500).send("Internal server error");
|
||||||
|
|
Loading…
Reference in a new issue