retrun json "null" if ctx.type is set to json and ctx.body is set to …#1059
retrun json "null" if ctx.type is set to json and ctx.body is set to …#1059likegun wants to merge 2 commits intokoajs:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1059 +/- ##
==========================================
+ Coverage 99.73% 99.73% +<.01%
==========================================
Files 5 5
Lines 374 376 +2
==========================================
+ Hits 373 375 +2
Misses 1 1
Continue to review full report at Codecov.
|
lib/response.js
Outdated
| // no content | ||
| if (null == val) { | ||
| if (!statuses.empty[this.status]) this.status = 204; | ||
| if(!statuses.empty[this.status]) { |
There was a problem hiding this comment.
Nit: space between if and parenthesis.
@jonathanong the reason this passes tests is because --fix is automatically run on travis, and so it'll fix it but the commit remains "invalid" according to eslintrc.yml.
lib/response.js
Outdated
| if (null == val) { | ||
| if (!statuses.empty[this.status]) this.status = 204; | ||
| if(!statuses.empty[this.status]) { | ||
| if(this.type == 'application/json') return this._body = 'null'; |
|
@fl0w done |
|
IMO it is a breaking change, and we have to hold this PR until we plan to develop koa@3.x. |
|
@dead-horse do you have any approximate schedule for the 3.0 to ship this within? |
|
@damianobarbati there's no schedule. if we get another PRs to justify a v3, we should push. |
issue 998