8000 refactor: use async function and support egg@2 by dead-horse · Pull Request #15 · eggjs/multipart · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

refactor: use async function and support egg@2 #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 10, 2017
Merged

refactor: use async function and support egg@2 #15

merged 4 commits into from
Nov 10, 2017

Conversation

dead-horse
Copy link
Member
Checklist
  • npm test passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)
Description of change

eggjs/egg#1564

此处有要注意的地方,只能通过 await parts() 而不能 await parts 来实现获取多个上传文件。但是在 generator function 中,仍然可以使用 yield parts

@codecov-io
Copy link
codecov-io commented Nov 9, 2017

Codecov Report

Merging #15 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #15   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           3      3           
  Lines          53     50    -3     
=====================================
- Hits           53     50    -3
Impacted Files Coverage Δ
app/extend/context.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a198e0e...4d228b0. Read the comment docs.

@popomore popomore mentioned this pull request Nov 9, 2017
29 tasks
@atian25
Copy link
Member
atian25 commented Nov 9, 2017

好像这个库没有多文件上传的 fixture ?

@dead-horse
Copy link
Member Author

有的,multipart 默认就支持

@dead-horse
Copy link
Member Author

但是之前利用了 generator 可以返回不同的内容实现的,所以可以 yield parts, 现在改 await 之后只能 await parts() 来实现了。

@atian25
Copy link
Member
atian25 commented Nov 9, 2017

但这个插件本身好像没有测试多文件的 fixture,要不要加下。

@dead-horse
Copy link
Member Author

有测试多 fields 的,没区别

app/extend/context.js Outdated 8000
@@ -34,9 +33,9 @@ module.exports = {
*/
getFileStream() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

怎么不直接 async getFileStream() {

@@ -19,30 +19,30 @@ module.exports = function* () {
// 例如 文件是必须字段,那么就报错
// 这里只是给出提示
if (!part || !part.filename) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

英文

@dead-horse
Copy link
Member Author

fixed

@dead-horse dead-horse merged commit 6a7fa06 into master Nov 10, 2017
@dead-horse dead-horse deleted the egg2 branch November 10, 2017 04:31
@dead-horse
Copy link
Member Author

2.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0