Azard / egg-oauth2-server

:star2: OAuth2 server plugin for egg.js based on node-oauth2-server
MIT License
179 stars 45 forks source link

使用this.x.ctx去获取变化的ctx #53

Closed rise0chen closed 5 years ago

rise0chen commented 5 years ago
Checklist
Affected core subsystem(s)
Description of change
codecov-io commented 5 years ago

Codecov Report

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

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #53   +/-   ##
=======================================
  Coverage   80.45%   80.45%           
=======================================
  Files           3        3           
  Lines          87       87           
=======================================
  Hits           70       70           
  Misses         17       17
Impacted Files Coverage Δ
lib/server.js 80.88% <100%> (ø) :arrow_up:

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 9f7ab03...4723a9c. Read the comment docs.

rise0chen commented 5 years ago

直接删除ctx参数有损兼容性。所以我强制提交,把ctx参数补上,把x参数放在第二位了

Azard commented 5 years ago

变量换一个名字吧,然后 constructor 参数可以加个 ? 当成可选的,文档再加一下说明?

rise0chen commented 5 years ago

变量名有点难取...... oauth2? or parent?
加个?当成可选的 是什么意思?

Azard commented 5 years ago

emmm 变量名再想一想,参数加 ? 表示可选参数,非强制传入

rise0chen commented 5 years ago

突然发现多此一举了。 解决方案: 不要在app/extend/oauth.js中使用this.ctx获取ctx。使用app.oAuth2Server.ctx即可