chore: Internal request filtering

This commit is contained in:
Tom Moor
2022-07-05 11:06:47 +02:00
parent 4e189b8970
commit c6fdffba77
8 changed files with 38 additions and 7 deletions

View File

@@ -82,7 +82,6 @@ export class StateStore {
export async function request(endpoint: string, accessToken: string) {
const response = await fetch(endpoint, {
method: "GET",
credentials: "same-origin",
headers: {
Authorization: `Bearer ${accessToken}`,
"Content-Type": "application/json",

View File

@@ -3,6 +3,7 @@ import util from "util";
import AWS from "aws-sdk";
import { addHours, format } from "date-fns";
import fetch from "fetch-with-proxy";
import { useAgent } from "request-filtering-agent";
import { v4 as uuidv4 } from "uuid";
import env from "@server/env";
import Logger from "@server/logging/Logger";
@@ -185,8 +186,9 @@ export const uploadToS3FromUrl = async (
}
try {
const res = await fetch(url);
// @ts-expect-error buffer exists, need updated typings
const res = await fetch(url, {
agent: useAgent(url),
});
const buffer = await res.buffer();
await s3
.putObject({