-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
retrun json "null" if ctx.type is set to json and ctx.body is set to … #1059
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.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicking
lib/response.js
Outdated
@@ -137,7 +137,10 @@ module.exports = { | |||
|
|||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -137,7 +137,10 @@ module.exports = { | |||
|
|||
// no content | |||
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'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
@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