Merge pull request #342 from aubergene/gh-338

Remove basepath from deferred urls and add trailing slash to root
This commit is contained in:
Rich Harris
2018-08-06 22:06:09 -04:00
committed by GitHub

View File

@@ -71,8 +71,9 @@ async function execute(emitter: EventEmitter, {
const deferreds = new Map();
function get_deferred(pathname: string) {
pathname = pathname.replace(`/${basepath}`, '')
if (!deferreds.has(pathname)) {
deferreds.set(pathname, new Deferred()) ;
deferreds.set(pathname, new Deferred());
}
return deferreds.get(pathname);
@@ -138,6 +139,13 @@ async function execute(emitter: EventEmitter, {
}
return ports.wait(port)
.then(() => handle(new URL(`/${basepath}`, origin))) // TODO all static routes
.then(() => {
// TODO all static routes
if (basepath) {
return handle(new URL(`/${basepath}/`, origin));
} else {
return handle(new URL('/', origin));
}
})
.then(() => proc.kill());
}