Fetch 远程资源
示例代码
async function handleRequest(request) {// 获取远程资源const response = await fetch('https://static.cloudcachetci.com/qcloud/main/scripts/release/common/vendors/jquery-3.2.1.min.js');return response;}addEventListener('fetch', event => {return event.respondWith(handleRequest(event.request));});
示例预览
在浏览器地址栏中输入匹配到边缘函数触发规则的 URL,即可预览到示例效果。
