Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

Toolbox rule problem #249

Open
jegj opened this issue May 23, 2017 · 1 comment
Open

Toolbox rule problem #249

jegj opened this issue May 23, 2017 · 1 comment

Comments

@jegj
Copy link

jegj commented May 23, 2017

I created the following rule using toolbox with a custom handler.
toolbox.router.get('/user/test', function(request) { return new Response('It works! ' + request.url); },{ origin: 'http://local.testserver:10000' });

It only works after i reload the page twice. The first time, it send the request to the network , but if i reload the page, i get the correct response from service worker

@JasperMaes
Copy link

JasperMaes commented Jun 2, 2017

Hi

I'm experiencing the exact same issue here.

My code is as shown below:

importScripts("/assets/js/sw-toolbox.js")

// Only works after reloading page, also tested with any instead of post
toolbox.router.post('/contact', function(request, values, options){
  console.log("INTERCEPTED POST REQUEST");
  return new Response("OK");
})

// Has no influence on whether the route above works or not
toolbox.router.default = toolbox.cacheFirst;

Any ideas on why this is happening? I've tried with and without the companion script to load the service worker. I'm using the last released version 3.6.1.

Thanks

Jasper

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants