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

origin in options with regexp value is broken #144

Closed
chenxsan opened this issue Jul 9, 2016 · 0 comments
Closed

origin in options with regexp value is broken #144

chenxsan opened this issue Jul 9, 2016 · 0 comments

Comments

@chenxsan
Copy link

chenxsan commented Jul 9, 2016

According to https://googlechrome.github.io/sw-toolbox/docs/master/tutorial-api.html:

The origin option is specific to the router methods, and can be either an exact string or a Regexp against which the origin of the Request must match for the route to be used.

So if I had

runtimeCaching: [{
  urlPattern: /^https:\/\/example\.com\/api/,
  handler: 'networkFirst'
}, {
  urlPattern: /\/articles\//,
  handler: 'fastest',
  options: { origin: /twitter\.com/}
}]

We would actually get origin: {}.

As in https://github.com/GoogleChrome/sw-precache/blob/master/lib/sw-precache.js#L213, JSON.stringify({origin: /twiter\.com/}) would give us "{"origin":{}}"

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

1 participant