mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-10 04:48:35 +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 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");
|
||||
|
|
Loading…
Reference in a new issue