|
|
@ -1,6 +1,4 @@
|
|
|
|
function pick(object, keys) {
|
|
|
|
import https from "https";
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default async function handler(req, res) {
|
|
|
|
export default async function handler(req, res) {
|
|
|
|
const headers = ["X-API-Key", "Content-Type", "Authorization"].reduce((obj, key) => {
|
|
|
|
const headers = ["X-API-Key", "Content-Type", "Authorization"].reduce((obj, key) => {
|
|
|
@ -11,9 +9,14 @@ export default async function handler(req, res) {
|
|
|
|
}, {});
|
|
|
|
}, {});
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
// this agent allows us to bypass the certificate check
|
|
|
|
|
|
|
|
// which is required for most self-signed certificates
|
|
|
|
|
|
|
|
const httpsAgent = new https.Agent({
|
|
|
|
|
|
|
|
rejectUnauthorized: false,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const result = await fetch(req.query.url, {
|
|
|
|
const result = await fetch(req.query.url, {
|
|
|
|
strictSSL: false,
|
|
|
|
agent: httpsAgent,
|
|
|
|
rejectUnhauthorized: false,
|
|
|
|
|
|
|
|
method: req.method,
|
|
|
|
method: req.method,
|
|
|
|
headers: headers,
|
|
|
|
headers: headers,
|
|
|
|
body: req.method == "GET" || req.method == "HEAD" ? null : req.body,
|
|
|
|
body: req.method == "GET" || req.method == "HEAD" ? null : req.body,
|
|
|
|