Skip to content

Commit

Permalink
feat: exports undici (#554)
Browse files Browse the repository at this point in the history
<!-- 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 -->
  • Loading branch information
killagu authored Dec 4, 2024
1 parent 104664d commit 3c9fca7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,11 @@ export class FetchFactory {
res = await UndiciFetch(input, init);
});
} catch (e: any) {
channels.response.publish({
channels.fetchResponse.publish({
fetch: fetchMeta,
error: e,
} as FetchResponseDiagnosticsMessage);
channels.fetchResponse.publish({
channels.response.publish({
request: reqMeta,
response: urllibResponse,
error: e,
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ export {
MockAgent, ProxyAgent, Agent, Dispatcher,
setGlobalDispatcher, getGlobalDispatcher,
Request, RequestInfo, RequestInit,
Response,
Response, BodyInit, ResponseInit,
Headers, FormData,
} from 'undici';
// HttpClient2 is keep compatible with urllib@2 HttpClient2
export {
Expand Down

0 comments on commit 3c9fca7

Please sign in to comment.