Comparing version 0.2.8 to 0.2.9
@@ -5,2 +5,9 @@ # Changelog | ||
### [0.2.9](https://github.com/unjs/h3/compare/v0.2.8...v0.2.9) (2021-04-06) | ||
### Bug Fixes | ||
* resolve handle when send was called ([fb58e5b](https://github.com/unjs/h3/commit/fb58e5b274272ba55df4bb38b874a688b617d541)) | ||
### [0.2.8](https://github.com/unjs/h3/compare/v0.2.7...v0.2.8) (2021-03-27) | ||
@@ -7,0 +14,0 @@ |
@@ -205,3 +205,3 @@ import { IncomingMessage, ServerResponse } from 'http'; | ||
declare function send(res: ServerResponse, data: any, type?: string): void; | ||
declare function send(res: ServerResponse, data: any, type?: string): Promise<unknown>; | ||
declare function defaultContentType(res: ServerResponse, type?: string): void; | ||
@@ -208,0 +208,0 @@ declare function sendRedirect(res: ServerResponse, location: string, code?: number): void; |
@@ -418,3 +418,8 @@ 'use strict'; | ||
} | ||
setImmediate(() => res.end(data)); | ||
return new Promise((resolve) => { | ||
setImmediate(() => { | ||
res.end(data); | ||
resolve(void 0); | ||
}); | ||
}); | ||
} | ||
@@ -559,11 +564,9 @@ function defaultContentType(res, type) { | ||
if (type === "string") { | ||
send(res, val, MIMES.html); | ||
return; | ||
return send(res, val, MIMES.html); | ||
} else if (type === "object" && val !== void 0) { | ||
if (val.buffer) { | ||
send(res, val); | ||
return send(res, val); | ||
} else { | ||
send(res, JSON.stringify(val, null, 2), MIMES.json); | ||
return send(res, JSON.stringify(val, null, 2), MIMES.json); | ||
} | ||
return; | ||
} | ||
@@ -570,0 +573,0 @@ } |
{ | ||
"name": "h3", | ||
"version": "0.2.8", | ||
"version": "0.2.9", | ||
"description": "Tiny JavaScript Server", | ||
@@ -5,0 +5,0 @@ "repository": "unjs/h3", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53297
1280