Skip to content
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

docs: Uniform the standards that we should acquire this parsed parame… #1038

Merged
merged 1 commit into from
Jun 12, 2017

Conversation

Ryqsky
Copy link
Contributor

@Ryqsky Ryqsky commented Jun 12, 2017

Uniform the standards that we should acquire this parsed parameter body through context.query , thus we can avoid confusion and easier to understand the api of docs.

before:
// app/controller/search.js

module.exports = function* (ctx) {
  ctx.body = `search: ${this.query.name}`;
};

after:
// app/controller/search.js

module.exports = function* (ctx) {
  ctx.body = `search: ${ctx.query.name}`;
};

In addition, when we write a Controller by defining a Controller class, it is invalid that we acquire this parsed parameter body through this.query.

// it is invalid.
// app/controller/post.js

module.exports = app => {
  class PostController extends app.Controller {
    * create() {
       // it is invalid. Cannot read property 'name' of undefined
       this.ctx.body = `search: ${this.query.name}`;      
    }
  }
  return PostController;
}
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

…ter body through context.query , thus we can avoid confusion and easier to understand the api of docs.
@codecov
Copy link

codecov bot commented Jun 12, 2017

Codecov Report

Merging #1038 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1038   +/-   ##
=======================================
  Coverage   98.96%   98.96%           
=======================================
  Files          28       28           
  Lines         675      675           
=======================================
  Hits          668      668           
  Misses          7        7

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 9d705e4...c93a8cf. Read the comment docs.

@popomore popomore merged commit 4890eda into eggjs:master Jun 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants