Skip to content

Commit 083c003

Browse files
Marius Kleidlm7kvqbe1
authored andcommitted
Get rid of unnecessary inner function
1 parent d84c2bb commit 083c003

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

lib/upload.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,22 +1108,19 @@ async function sendRequest(
11081108
await options.onBeforeRequest(req)
11091109
}
11101110

1111-
const sendWithStallDetection = async (): Promise<HttpResponse> => {
1112-
if (stallDetector) {
1113-
stallDetector.start()
1114-
}
1111+
if (stallDetector) {
1112+
stallDetector.start()
1113+
}
11151114

1116-
try {
1117-
return await req.send(body)
1118-
} finally {
1119-
if (stallDetector) {
1120-
stallDetector.stop()
1121-
}
1115+
let res: HttpResponse
1116+
try {
1117+
res = await req.send(body)
1118+
} finally {
1119+
if (stallDetector) {
1120+
stallDetector.stop()
11221121
}
11231122
}
11241123

1125-
const res = await sendWithStallDetection()
1126-
11271124
if (typeof options.onAfterResponse === 'function') {
11281125
await options.onAfterResponse(req, res)
11291126
}

0 commit comments

Comments
 (0)