1
0
Fork 0
mirror of https://codeberg.org/ashley/poke.git synced 2024-11-16 23:34:40 -05:00

test ignore

This commit is contained in:
Ashley 2023-11-22 16:11:01 +00:00
parent 88c745e892
commit 9a66aa08a7

View file

@ -1,6 +1,7 @@
const express = require("express");
const fetch = require("node-fetch");
const { URL } = require("url");
const { Readable } = require("node:stream");
// Array of hostnames that will be proxied
const URL_WHITELIST = [
@ -58,6 +59,8 @@ app.use(function (req, res, next) {
* @param {express.Response} res
*/
const proxy = async (req, res) => {
const { fetch } = await import("undici")
try {
let url;
@ -80,7 +83,7 @@ const proxy = async (req, res) => {
method: req.method,
});
f.body.pipe(res);
Readable.fromWeb(f.body).pipe(res);
} catch (e) {
console.log(`==> Error: ${e}`);
res.status(500).send("Internal server error");