Skip to content

Commit

Permalink
fix: await on send() calls (#1701)
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 authored Sep 7, 2023
1 parent 0099df2 commit a228372
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/dev/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function errorHandler(error: any, event: H3Event) {
"<progress></progress><script>document.querySelector('progress').indeterminate=true</script>";
}

send(
return send(
event,
`<!DOCTYPE html>
<html lang="en">
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ export default <NitroErrorHandler>function (error, event) {

if (isJsonRequest(event)) {
setResponseHeader(event, "Content-Type", "application/json");
send(event, JSON.stringify(errorObject));
return send(event, JSON.stringify(errorObject));
} else {
setResponseHeader(event, "Content-Type", "text/html");
send(event, renderHTMLError(errorObject));
return send(event, renderHTMLError(errorObject));
}
};

Expand Down
3 changes: 1 addition & 2 deletions src/runtime/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ export function defineRenderHandler(handler: RenderHandler) {
// TODO: Use serve-placeholder
if (event.path.endsWith("/favicon.ico")) {
setResponseHeader(event, "Content-Type", "image/x-icon");
send(
return send(
event,
"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
);
return;
}

const response = await handler(event);
Expand Down

0 comments on commit a228372

Please sign in to comment.