Skip to content

Commit a524a26

Browse files
author
vhess
committed
remove custom fetch method for now
1 parent ba769a6 commit a524a26

File tree

2 files changed

+0
-27
lines changed

2 files changed

+0
-27
lines changed

README.md

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -534,30 +534,6 @@ const proxy = createProxyServer({
534534
}).listen(8443);
535535
```
536536

537-
##### Using Custom Fetch Implementation
538-
539-
```js
540-
import { createProxyServer } from "http-proxy-3";
541-
import { fetch as undiciFetch, Agent } from "undici";
542-
543-
// Wrap undici's fetch with custom configuration
544-
function customFetch(url, opts) {
545-
opts = opts || {};
546-
opts.dispatcher = new Agent({ allowH2: true });
547-
return undiciFetch(url, opts);
548-
}
549-
550-
const proxy = createProxyServer({
551-
target: "https://api.example.com",
552-
fetch: {
553-
// Pass your custom fetch implementation
554-
customFetch,
555-
onBeforeRequest: async (requestOptions, req, res, options) => {
556-
requestOptions.headers['X-Custom'] = 'value';
557-
}
558-
}
559-
});
560-
```
561537

562538
**Important Notes:**
563539
- When `fetch` option is provided, the proxy uses the fetch API instead of Node.js native `http`/`https` modules
@@ -668,7 +644,6 @@ const proxy = createProxyServer({
668644
- `requestOptions`: Additional fetch request options
669645
- `onBeforeRequest`: Async callback called before making the fetch request
670646
- `onAfterResponse`: Async callback called after receiving the fetch response
671-
- `customFetch`: Custom fetch implementation to use instead of the global fetch
672647
673648
**NOTE:**
674649
`options.ws` and `options.ssl` are optional.

lib/http-proxy/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@ export interface FetchOptions {
122122
res: http.ServerResponse,
123123
options: NormalizedServerOptions,
124124
) => void | Promise<void>;
125-
/** Custom fetch implementation */
126-
customFetch?: typeof fetch;
127125
}
128126

129127
export interface NormalizedServerOptions extends ServerOptions {

0 commit comments

Comments
 (0)