-
-
Notifications
You must be signed in to change notification settings - Fork 380
check res.getHeader type before exec #381
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #381 +/- ##
=======================================
Coverage 96.96% 96.96%
=======================================
Files 7 7
Lines 264 264
=======================================
Hits 256 256
Misses 8 8
Continue to review full report at Codecov.
|
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #381 +/- ##
=======================================
Coverage 96.96% 96.96%
=======================================
Files 7 7
Lines 264 264
=======================================
Hits 256 256
Misses 8 8
Continue to review full report at Codecov.
|
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "webpack-dev-middleware", | |||
"version": "3.6.1", | |||
"version": "3.6.2", |
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.
Avoid this
@@ -79,7 +79,7 @@ module.exports = function wrapper(context) { | |||
contentType += '; charset=UTF-8'; | |||
} | |||
|
|||
if (!res.getHeader('Content-Type')) { | |||
if (!res.getHeader || (typeof res.getHeader === 'function' && !res.getHeader('Content-Type'))) { |
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 simplify this? Looks very misleading, like:
if (res.getHeader && !res.getHeader('Content-Type')) {
}
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.
I think the question to be answered first is: What to do in the case where res.getHeader
is not available. Execute the if
statement or not?
@sjy in your statement you will execute the if
statement when res.getHeader
is not available. Is it correct, that set Header function is available though?
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.
since the use case only effects project using the latest webpack-koa which will be fixed, this pr is will be closed. @dmohns, thanks your attention, code changes here is more like a hot-fix.
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.
since the use case only effects project using the latest webpack-koa which will be fixed, this pr is will be closed. @dmohns, thanks your attention, code changes here is more like a hot-fix.
There is no need for this pull request. It's a problem with koa wrapper which does not provide a |
#380