handle non-Sapper responses when exporting - fixes #392

This commit is contained in:
Rich Harris
2018-08-30 18:22:40 -04:00
parent 1e22031765
commit 65d0172abe
6 changed files with 42 additions and 52 deletions

View File

@@ -414,18 +414,6 @@ function get_page_handler(
res.setHeader('Location', location);
res.end();
if (process.send) {
process.send({
__sapper__: true,
event: 'file',
url: req.url,
method: req.method,
status: redirect.statusCode,
type: 'text/html',
body: `<script>window.location.href = "${location}"</script>`
});
}
return;
}
@@ -512,18 +500,6 @@ function get_page_handler(
res.statusCode = status;
res.end(body);
if (process.send) {
process.send({
__sapper__: true,
event: 'file',
url: req.url,
method: req.method,
status,
type: 'text/html',
body
});
}
}).catch(err => {
if (error) {
// we encountered an error while rendering the error page — oops