koajs / koajs/send

[fix] await send() never resolves if file is not found

Open
#145 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
433
Forks
86
PR merge metrics
No merged PRs in 30d

Description

## Describe the bug
using this example code:
await send(ctx, ctx.path, { root: __dirname + '/public' });
If the file is not found, the promise never resolves. This is a memory leak.

**Node.js version:**

**OS version:**

**Description:**

## Actual behavior

## Expected behavior

## Code to reproduce

## Checklist

- [ ] I have searched through GitHub issues for similar issues.
- [ ] I have completely read through the README and documentation.
- [ ] I have tested my code with the latest version of Node.js and this package and confirmed it is still not working.

Contributor guide

Open the contributing guide

Research direction

Start with the reported await send(ctx, ctx.path, { root: __dirname + '/public' }) call and inspect the send implementation for the missing-file path. Reproduce the case with a nonexistent file; done means the promise settles instead of remaining unresolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.