Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPTIONS request reported as GET #1498

Open
anthumchris opened this issue Jan 17, 2020 · 1 comment
Open

OPTIONS request reported as GET #1498

anthumchris opened this issue Jan 17, 2020 · 1 comment

Comments

@anthumchris
Copy link

Should HTTP OPTIONS requests be accessible and available within a SW's fetch event?
OPTIONS requests are currently reported as GET requests even though the browser sends an HTTP OPTIONS request.

sw.js

self.addEventListener("fetch", function (event) {
  console.log(event.request.method, event.request.url);
});

app.js

navigator.serviceWorker.register('./sw.js')
fetch('https://example.com', {
  headers: {
    'force-cors-preflight': 'foo'
  }
});
@wanderview
Copy link
Member

Service worker interception occurs before any CORS preflight is made. AFAIK there is no way to get a FetchEvent for a CORS preflight.

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

No branches or pull requests

2 participants