Skip to content

Commit

Permalink
fix(cli/dts): Make respondWith() return a Promise (denoland#10128)
Browse files Browse the repository at this point in the history
  • Loading branch information
nayeemrmn committed Apr 13, 2021
1 parent a8057e3 commit df49a84
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cli/dts/lib.deno.unstable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ declare namespace Deno {

export interface RequestEvent {
readonly request: Request;
respondWith(r: Response | Promise<Response>): void;
respondWith(r: Response | Promise<Response>): Promise<void>;
}

export interface HttpConn extends AsyncIterable<RequestEvent> {
Expand Down
4 changes: 2 additions & 2 deletions runtime/js/40_http.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@
return array;
}

function createRespondWith(responseSenderRid, connRid) {
return async function (resp) {
function createRespondWith(responseSenderRid) {
return async function respondWith(resp) {
if (resp instanceof Promise) {
resp = await resp;
}
Expand Down

0 comments on commit df49a84

Please sign in to comment.