-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
feat: support Keep-Alive Header #2146
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2146 +/- ##
==========================================
+ Coverage 99.59% 99.59% +<.01%
==========================================
Files 29 29
Lines 743 748 +5
==========================================
+ Hits 740 745 +5
Misses 3 3
Continue to review full report at Codecov.
|
app/middleware/meta.js
Outdated
module.exports = options => { | ||
module.exports = (options, app) => { | ||
let server; | ||
app.once('server', s => { |
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.
app 上没有直接获取 server 的?
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.
我直接加个 app.server 好了
app/middleware/meta.js
Outdated
// try to support Keep-Alive Header | ||
if (server && server.keepAliveTimeout && server.keepAliveTimeout >= 1000 && ctx.header.connection !== 'close') { | ||
const timeout = parseInt(server.keepAliveTimeout / 1000); | ||
ctx.set('keep-alive', `timeout=${timeout}`); |
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.
如果用户自己设置了这个 header 呢?
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.
这个 header 不允许应用设置的,必须保证它的正确性
92e2229
to
1db4217
Compare
增加 app.server |
mm.app 是不是也考虑 emit server |
@popomore 嗯,我加上 |
feat: support Keep-Alive Header (#2146) node-modules/agentkeepalive#58
node-modules/agentkeepalive#58
Checklist
npm test
passesAffected core subsystem(s)
Description of change