Skip to content

Commit

Permalink
Regression from modernization; re-adds writer
Browse files Browse the repository at this point in the history
Needed in stick’s GZIP module
  • Loading branch information
botic committed Jun 23, 2021
1 parent 22773f1 commit 0e87bc4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions modules/ringo/jsgi/connector.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,17 @@ const writeHeaders = (servletResponse, headers) => {
};

const writeBody = (response, body, charset) => {
if (body && typeof body.forEach == "function") {
if (body && typeof body.forEach === "function") {
const output = response.getOutputStream();
body.forEach(part => {
const writer = (part) => {
if (!(part instanceof binary.Binary)) {
part = binary.toByteString(part, charset);
}
output.write(part);
});
if (typeof body.close == "function") {
body.close();
};
body.forEach(writer);
if (typeof body.close === "function") {
body.close(writer);
}
} else {
throw new Error("Response body doesn't implement forEach: " + body);
Expand Down

0 comments on commit 0e87bc4

Please sign in to comment.