Skip to content

Commit 3c9fca7

Browse files
authored
feat: exports undici (#554)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved error handling and diagnostics publishing for fetch operations, ensuring errors are reported through the correct channel. - **New Features** - Enhanced type definitions with new types for better type safety: `BodyInit`, `ResponseInit`, `Headers`, and `FormData`. - Optimized handling of HTTP requests with caching for socket-based clients. - **Documentation** - Updated export statements to maintain compatibility with existing libraries while enhancing functionality. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 104664d commit 3c9fca7

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/fetch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,11 @@ export class FetchFactory {
223223
res = await UndiciFetch(input, init);
224224
});
225225
} catch (e: any) {
226-
channels.response.publish({
226+
channels.fetchResponse.publish({
227227
fetch: fetchMeta,
228228
error: e,
229229
} as FetchResponseDiagnosticsMessage);
230-
channels.fetchResponse.publish({
230+
channels.response.publish({
231231
request: reqMeta,
232232
response: urllibResponse,
233233
error: e,

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ export {
4444
MockAgent, ProxyAgent, Agent, Dispatcher,
4545
setGlobalDispatcher, getGlobalDispatcher,
4646
Request, RequestInfo, RequestInit,
47-
Response,
47+
Response, BodyInit, ResponseInit,
48+
Headers, FormData,
4849
} from 'undici';
4950
// HttpClient2 is keep compatible with urllib@2 HttpClient2
5051
export {

0 commit comments

Comments
 (0)