mirror of
https://github.com/danbulant/Mangades
synced 2026-07-07 03:51:00 +00:00
add debug mode
This commit is contained in:
parent
8a26a6ae59
commit
2a65e607f2
1 changed files with 17 additions and 0 deletions
17
src/routes/cors-anywhere/dbg/+server.ts
Normal file
17
src/routes/cors-anywhere/dbg/+server.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
import { json } from '@sveltejs/kit';
|
||||||
|
|
||||||
|
/** @type {import('./$types').RequestHandler} */
|
||||||
|
export async function GET({ url }) {
|
||||||
|
console.log("[CORS-DBG] " + url.searchParams.get('url'));
|
||||||
|
const ret = await fetch(url.searchParams.get('url'));
|
||||||
|
let text = await ret.text();
|
||||||
|
let data = text;
|
||||||
|
try {
|
||||||
|
data = JSON.parse(text);
|
||||||
|
} catch (e) {}
|
||||||
|
|
||||||
|
return json({
|
||||||
|
headers: Object.fromEntries(ret.headers.entries()),
|
||||||
|
body: data
|
||||||
|
});
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue