Open gabrielcsapo opened 2 years ago
fixes #287
This is the demo code I ran to get some output from my experiment
<!DOCTYPE html> <head> <meta charset="UTF-8"> <title>Pretenderjs</title> </head> <body> <script src="./dist/pretender.bundle.js"></script> <script> (async function() { const server = new Pretender(function() { this.get('/hello-world', request => [200, {}, "hello world!"]); }); server.unhandledRequest = function(verb, path, request) { console.log(verb, path, request); } await fetch('/hello-world'); }()) </script> </body> </html>
unhandled requests work as well!
<!DOCTYPE html> <head> <meta charset="UTF-8"> <title>Pretenderjs</title> </head> <body> <script src="./dist/pretender.bundle.js"></script> <script> (async function() { const server = new Pretender(function() { this.get('/hello-world', request => [200, {}, "hello world!"]); }); server.unhandledRequest = function(verb, path, request) { console.log('unhandledRequest', verb, path, request); } await fetch('/hello-world'); await fetch('/hello'); }()) </script> </body> </html>
fixes #287
This is the demo code I ran to get some output from my experiment
unhandled requests work as well!