Skip to content

Commit d4104d3

Browse files
authored
feat: expose fetchFn override in http transport (#3917)
1 parent e72d356 commit d4104d3

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

.changeset/tame-onions-explain.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"viem": patch
3+
---
4+
5+
Added `fetchFn` to `http` transport.

src/clients/transports/http.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export type HttpTransportConfig<
3636
wait?: number | undefined
3737
}
3838
| undefined
39+
fetchFn?: HttpRpcClientOptions['fetchFn'] | undefined
3940
/**
4041
* Request configuration to pass to `fetch`.
4142
* @link https://developer.mozilla.org/en-US/docs/Web/API/fetch
@@ -93,6 +94,7 @@ export function http<
9394
): HttpTransport<rpcSchema, raw> {
9495
const {
9596
batch,
97+
fetchFn,
9698
fetchOptions,
9799
key = 'http',
98100
methods,
@@ -111,6 +113,7 @@ export function http<
111113
if (!url_) throw new UrlRequiredError()
112114

113115
const rpcClient = getHttpRpcClient(url_, {
116+
fetchFn,
114117
fetchOptions,
115118
onRequest: onFetchRequest,
116119
onResponse: onFetchResponse,

0 commit comments

Comments
 (0)