Skip to content

Commit

Permalink
Implement missing methods from response object to fix the middleware …
Browse files Browse the repository at this point in the history
…issue in next 14.4.12 or lower. (#454)
  • Loading branch information
vladiulianbogdan authored Jun 28, 2024
1 parent 3a0bc84 commit 9285014
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions packages/open-next/src/http/openNextResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,4 +306,23 @@ export class OpenNextNodeResponse extends Transform implements ServerResponse {
}
callback();
}

get sent() {
return this.finished || this.headersSent;
}

getHeaderValues(name: string): string[] | undefined {
const values = this.getHeader(name);

if (values === undefined) return undefined;

return (Array.isArray(values) ? values : [values]).map((value) =>
value.toString(),
);
}

send() {
const body = this.body;
this.end(body);
}
}

0 comments on commit 9285014

Please sign in to comment.