From bc8d8311d1e8bdfc862b6707113b601943fb6dce Mon Sep 17 00:00:00 2001 From: martin-mfg <2026226+martin-mfg@users.noreply.github.com> Date: Tue, 24 Jun 2025 08:40:44 +0000 Subject: [PATCH] test: add axios to router --- .vercel/output/functions/api.func/router.js | 44 +++++++++++++-------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/.vercel/output/functions/api.func/router.js b/.vercel/output/functions/api.func/router.js index 2e27d26f..360ae4cf 100644 --- a/.vercel/output/functions/api.func/router.js +++ b/.vercel/output/functions/api.func/router.js @@ -1,19 +1,29 @@ -import { default as gist } from './core-app/api/gist.js' -import { default as pin } from './core-app/api/pin.js' +import { default as gist } from "./core-app/api/gist.js"; +import { default as pin } from "./core-app/api/pin.js"; +import axios from "axios"; export default async (req, res) => { - const url = new URL(req.url, 'https://localhost') - req.query = Object.fromEntries(url.searchParams.entries()) - switch(url.pathname) { - case '/gist': - gist(req, res) - break - case '/pin': - pin(req, res) - break - default: - res.statusCode = 404 - res.end('Not Found') - break - } -} + const url = new URL(req.url, "https://localhost"); + req.query = Object.fromEntries(url.searchParams.entries()); + switch (url.pathname) { + case "/gist": + gist(req, res); + break; + case "/pin": + pin(req, res); + break; + default: + res.statusCode = 404; + res.end("Not Found"); + break; + } +}; + +export const dummyRequest = (data, headers) => { + return axios({ + url: "https://api.github.com/graphql", + method: "post", + headers, + data, + }); +};