Skip to content

Commit 2fe5804

Browse files
committed
Axios client for EventSource review feedback
1 parent 33c80e6 commit 2fe5804

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/api-helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export function errToStr(error: unknown, def: string) {
1111
} else if (isApiErrorResponse(error)) {
1212
return error.message
1313
} else if (error instanceof ErrorEvent) {
14-
return error.code ? `${error.code}: ${error.message}` : error.message?.toString() || def
14+
return error.code ? `${error.code}: ${error.message || def}` : error.message || def
1515
} else if (typeof error === "string" && error.trim().length > 0) {
1616
return error
1717
}

src/api.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,9 @@ export function createStreamingFetchAdapter(axiosInstance: AxiosInstance) {
157157
},
158158
})
159159

160-
const createReader = () => stream.getReader()
161-
162160
return {
163161
body: {
164-
getReader: () => createReader(),
162+
getReader: () => stream.getReader(),
165163
},
166164
url: urlStr,
167165
status: response.status,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy