Skip to content

Commit 8ab3a55

Browse files
committed
Remove redundant code
1 parent 0e9ffeb commit 8ab3a55

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

packages/server/src/server.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,8 @@ export class Server extends EventEmitter {
228228
if (context.signal.aborted) {
229229
// If the request was aborted, we should not send any response body.
230230
// The server should just close the connection.
231-
return this.handleAbortedRequest(context, resp)
231+
resp.headers.set('Connection', 'close')
232+
return resp
232233
}
233234

234235
return resp
@@ -272,7 +273,7 @@ export class Server extends EventEmitter {
272273
return new Response(body, {status, headers})
273274
}
274275

275-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
276+
// biome-ignore lint/suspicious/noExplicitAny: it's fine
276277
listen(...args: any[]): http.Server {
277278
return http.createServer(this.handle.bind(this)).listen(...args)
278279
}
@@ -285,18 +286,6 @@ export class Server extends EventEmitter {
285286
return this.datastore.deleteExpired()
286287
}
287288

288-
protected handleAbortedRequest(context: CancellationContext, resp: Response) {
289-
const isAborted = context.signal.aborted
290-
if (isAborted) {
291-
// If the request was aborted, we should not send any response body.
292-
// The server should just close the connection.
293-
resp.headers.set('Connection', 'close')
294-
return resp
295-
}
296-
297-
return resp
298-
}
299-
300289
protected createContext() {
301290
// Initialize two AbortControllers:
302291
// 1. `requestAbortController` for instant request termination, particularly useful for stopping clients to upload when errors occur.

0 commit comments

Comments
 (0)