-
-
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
fix: use non deprecated custom inspect #1198
Conversation
db512bc
to
30608fa
Compare
Codecov Report
@@ Coverage Diff @@
## master #1198 +/- ##
==========================================
+ Coverage 99.73% 99.73% +<.01%
==========================================
Files 5 5
Lines 373 383 +10
==========================================
+ Hits 372 382 +10
Misses 1 1
Continue to review full report at Codecov.
|
lib/response.js
Outdated
module.exports[util.inspect.custom] = function() { | ||
if (!this.res) return; | ||
const o = this.toJSON(); | ||
o.body = this.body; |
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.
can we move this line to this.toJSON()
?
I just pushed another commit to simplify it. That way it is always aligned, no matter if there are any changes to the actual inspection function. |
lib/application.js
Outdated
@@ -23,6 +23,7 @@ const http = require('http'); | |||
const only = require('only'); | |||
const convert = require('koa-convert'); | |||
const deprecate = require('depd')('koa'); | |||
const util = require('util'); |
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.
/home/travis/build/koajs/koa/lib/application.js: Duplicate declaration "util"
24 | const convert = require('koa-convert');
25 | const deprecate = require('depd')('koa');
> 26 | const util = require('util');
please fix this and good to merge. 👍
Custom inspection with the `inspect` property is deprecated and will not work in Node.js 11 anymore. This fixes it by using the custom inspect symbol where existent and falls back to the old style in case it does not exist.
0ed1f0a
to
53daa01
Compare
Rebased and force pushed. |
Ping @dead-horse |
Should we backport this to 1.x as well perhaps? |
Custom inspection with the
inspect
property is deprecated and willnot work in Node.js 11 anymore. This fixes it by using the custom
inspect symbol where existent and falls back to the old style in case
it does not exist.