itty-bitty/netlify/edge-functions/echo.js

12 lines
337 B
JavaScript
Raw Permalink Normal View History

2022-06-19 02:07:47 +00:00
export default async (request, context) => {
let url = new URL(request.url);
let durl = url.search.substring(1);
let components = durl.split(",");
let data = components.pop();
components = components.shift().split(":");
let type = components.pop();
return new Response(data, {
headers: { "content-type": type},
});
}