-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
refactor(middleware): update middleware/common to ES6 #3028
Conversation
lib/middleware/common.js
Outdated
@@ -117,7 +120,7 @@ var createServeFile = function (fs, directory, config) { | |||
responseData = (transform && transform(data.toString())) || data | |||
|
|||
if (rangeHeader) { | |||
var code = convertForRangeRequest() | |||
const code = convertForRangeRequest() |
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.
You can update L122-L127 into response.writeHead(rangeHeader ? convertForRangeRequest() : 200)
.
Same with L97-L101
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.
done
lib/middleware/common.js
Outdated
log.warn('404: ' + path) | ||
response.writeHead(404) | ||
return response.end('NOT FOUND') | ||
} | ||
|
||
var createServeFile = function (fs, directory, config) { | ||
var cache = Object.create(null) | ||
const createServeFile = function (fs, directory, config) { |
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.
What do you think about function createServeFile (fs, directory, config)
instead of const
?
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.
done (also others)
9fa79eb
to
7232042
Compare
No description provided.