'Google Workbox not intercepting POST requests

I am trying to intercept POST requests using a serviceworker with Workbox. However the route does not seem to register. When online the request just goes through and nothing is logged. When offline the console logges an net::ERR_INTERNET_DISCONNECTED error. The request also does not seem to fall into the catchHandler.

service-worker.js

registerRoute(
    ({url}) => url.pathname.endsWith('detailScreen'),
    ({request, url}) => {
        console.log('POST', request, url)
    },
    'POST')

setCatchHandler(async options => {
    console.log(options.request, options.url)
    return Response.error();
})

request: https://test.com/admin/crm/relation/detailScreen



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source