File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -184,6 +184,8 @@ export async function serveFile(
184184 filePath : string ,
185185 options ?: ServeFileOptions ,
186186) : Promise < Response > {
187+ await req . body ?. cancel ( ) ;
188+
187189 if ( req . method !== METHOD . Get && req . method !== METHOD . Head ) {
188190 return createStandardResponse ( STATUS_CODE . MethodNotAllowed ) ;
189191 }
@@ -194,15 +196,13 @@ export async function serveFile(
194196 fileInfo ??= await Deno . stat ( filePath ) ;
195197 } catch ( error ) {
196198 if ( error instanceof Deno . errors . NotFound ) {
197- await req . body ?. cancel ( ) ;
198199 return createStandardResponse ( STATUS_CODE . NotFound ) ;
199200 } else {
200201 throw error ;
201202 }
202203 }
203204
204205 if ( fileInfo . isDirectory ) {
205- await req . body ?. cancel ( ) ;
206206 return createStandardResponse ( STATUS_CODE . NotFound ) ;
207207 }
208208
You can’t perform that action at this time.
0 commit comments