2023-04-10 00:23:51 +00:00
|
|
|
export default {
|
|
|
|
async fetch(req, _env) {
|
|
|
|
let url = req.url;
|
|
|
|
let iSlash = url.indexOf('/',11);
|
|
|
|
let nUrl = url.substring(iSlash+1);
|
2023-05-26 07:48:51 +00:00
|
|
|
return await goUrl(req, nUrl);
|
2023-04-10 00:23:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-26 07:48:51 +00:00
|
|
|
async function goUrl(request, url) {
|
2023-04-10 00:23:51 +00:00
|
|
|
let fp = {
|
2023-07-18 02:54:53 +00:00
|
|
|
method: request.method
|
2023-05-26 07:48:51 +00:00
|
|
|
};
|
2023-07-18 02:54:53 +00:00
|
|
|
fp.headers = new Headers(request.headers);
|
|
|
|
for(var i = 2; i < arguments.length-1; i=i+2){
|
|
|
|
fp.headers[arguments[i]] = arguments[i+1];
|
|
|
|
}
|
2023-05-26 07:48:51 +00:00
|
|
|
return await fetch(url, fp);
|
|
|
|
}
|