Skip to content

Commit ede1cde

Browse files
authored
fix: pass HTTP to EDR (#5846)
1 parent f6ac346 commit ede1cde

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

.changeset/neat-moose-compare.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"hardhat": patch
3+
---
4+
5+
Fixed broken HTTP headers for forked configurations

packages/hardhat-core/src/internal/hardhat-network/provider/provider.ts

+16
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import type {
1616
RawTrace,
1717
Response,
1818
SubscriptionEvent,
19+
HttpHeader,
1920
} from "@nomicfoundation/edr";
2021
import { Common } from "@nomicfoundation/ethereumjs-common";
2122
import chalk from "chalk";
@@ -201,12 +202,27 @@ export class EdrProviderWrapper
201202

202203
let fork;
203204
if (config.forkConfig !== undefined) {
205+
let httpHeaders: HttpHeader[] | undefined;
206+
if (config.forkConfig.httpHeaders !== undefined) {
207+
httpHeaders = [];
208+
209+
for (const [name, value] of Object.entries(
210+
config.forkConfig.httpHeaders
211+
)) {
212+
httpHeaders.push({
213+
name,
214+
value,
215+
});
216+
}
217+
}
218+
204219
fork = {
205220
jsonRpcUrl: config.forkConfig.jsonRpcUrl,
206221
blockNumber:
207222
config.forkConfig.blockNumber !== undefined
208223
? BigInt(config.forkConfig.blockNumber)
209224
: undefined,
225+
httpHeaders,
210226
};
211227
}
212228

0 commit comments

Comments
 (0)