Skip to content

Commit

Permalink
Merge pull request #5710 from Ivan-Feofanov/main
Browse files Browse the repository at this point in the history
Add streaming response
  • Loading branch information
fvictorio authored Sep 9, 2024
2 parents 7cbd23f + 859032f commit 75d4219
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/warm-beans-tie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"hardhat": patch
---

Hardhat node can now handle large response objects by streaming them.
1 change: 1 addition & 0 deletions packages/hardhat-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
"glob": "7.2.0",
"immutable": "^4.0.0-rc.12",
"io-ts": "1.10.4",
"json-stream-stringify": "^3.1.4",
"keccak": "^3.0.2",
"lodash": "^4.17.11",
"mnemonist": "^0.38.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { IncomingMessage, ServerResponse } from "http";
import getRawBody from "raw-body";
import WebSocket from "ws";
import { JsonStreamStringify } from "json-stream-stringify";

import { EIP1193Provider } from "../../../types";
import {
Expand Down Expand Up @@ -135,7 +136,7 @@ export class JsonRpcHandler {
) {
res.statusCode = 200;
res.setHeader("Content-Type", "application/json");
res.end(JSON.stringify(rpcResp));
new JsonStreamStringify(rpcResp).pipe(res);
}

private async _handleSingleRequest(
Expand Down
9 changes: 9 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 75d4219

Please sign in to comment.