不支持 Workbox 请求方法 'POST'
Workbox Request method 'POST' is unsupported
我正在使用此站点的代码:https://developers.google.com/web/tools/workbox/modules/workbox-routing
我的代码如下:
workbox.routing.registerRoute(
new RegExp('http://localhost:64445.*/'),
workbox.strategies.staleWhileRevalidate({
cacheName:'Post-Run-time-cache'
}),
'POST'
);
它给了我错误:
Uncaught (in promise) TypeError: Request method 'POST' is unsupported
我不知道哪里出了问题。它来自文档,但不受支持??为什么。谢谢您的帮助。
缓存存储 API 不支持使用 Request
对象 method
不是 'GET'
作为缓存键。尝试将 'POST'
请求存储在缓存中(这在 staleWhileRevalidate
策略的幕后发生)将失败,并出现类似于您所看到的错误——尽管我认为有一个信息量更大的错误在 localhost
.
处于 Workbox 的开发模式时记录
如果您希望重试失败的 'POST'
请求,我建议您使用 workbox-background-sync
module。
我正在使用此站点的代码:https://developers.google.com/web/tools/workbox/modules/workbox-routing
我的代码如下:
workbox.routing.registerRoute(
new RegExp('http://localhost:64445.*/'),
workbox.strategies.staleWhileRevalidate({
cacheName:'Post-Run-time-cache'
}),
'POST'
);
它给了我错误:
Uncaught (in promise) TypeError: Request method 'POST' is unsupported
我不知道哪里出了问题。它来自文档,但不受支持??为什么。谢谢您的帮助。
缓存存储 API 不支持使用 Request
对象 method
不是 'GET'
作为缓存键。尝试将 'POST'
请求存储在缓存中(这在 staleWhileRevalidate
策略的幕后发生)将失败,并出现类似于您所看到的错误——尽管我认为有一个信息量更大的错误在 localhost
.
如果您希望重试失败的 'POST'
请求,我建议您使用 workbox-background-sync
module。