我正在使用由 HTTP 请求触发的 Cloudflare Worker。我想接受传入请求,更改 url 但保持所有其他属性不变,然后发出请求。结构如下:
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
#change the value of request.url and then...
return fetch(request)
.then(response => {
return response;
});
}
Run Code Online (Sandbox Code Playgroud)