multipart/app.js - files is accessed directly from ctx.request as opposed to ctx.request.body
- Dominant language
- JavaScript
- Stars
- 4.5k
- Forks
- 721
- PR merge metrics
- No merged PRs in 30d
Description
I know the version of `koa` used in the examples differs from the version I'm using following along with the examples (`2.2.0` vs. `2.5.2`), but wanted to raise a fundamental difference in the `ctx` object for extracting files from the request:
[`app.js`](https://github.com/koajs/examples/blob/master/multipart/app.js#L25) in the examples has the following:
``` js
const files = ctx.request.body.files || {};
```
In version `2.5.2`, this has to be set as follows:
``` js
const files = ctx.request.files || {};
```
Pretty sure it's a difference between versions, but figured I'd raise the issue in the event that someone else has troubles.
Contributor guide
Research direction
Start with multipart/app.js around the files assignment and compare the example's Koa 2.2.0 context.request.body usage with the reported Koa 2.5.2 context.request.files behavior. Verify the dependency and multipart setup used by the example, then update the example or its documentation so the extraction matches the supported version; run the multipart example to confirm file uploads still work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100