Skip to content

Instantly share code, notes, and snippets.

@erdoganoksuz
Created March 26, 2018 17:05
Show Gist options
  • Save erdoganoksuz/43db40f93ee680f21c54e8573da361e0 to your computer and use it in GitHub Desktop.
Save erdoganoksuz/43db40f93ee680f21c54e8573da361e0 to your computer and use it in GitHub Desktop.
self.addEventListener('fetch', function (event) {
if (event.request.url == "https://jsonplaceholder.typicode.com/posts/1") {
console.log(event)
var init = {
status: 200,
statusText: "OK",
headers: {
'Content-Type': 'application/json'
}
};
var response = new Response('{Hello World"}', init);
event.respondWith(response);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment