Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_onResult: function (err, mimeType) {
if (err) {
this.failed(err);
} else {
this.completed({
type: mimeType,
extension: mime.extensions[mimeType] ||
mime.extensions[DEFAULT_TYPE]
});
}
},
_onResult: function (err, mimeType) {
if (err) {
this.failed(err);
} else {
this.completed({
type: mimeType,
extension: mime.extensions[mimeType] ||
mime.extensions[DEFAULT_TYPE]
});
}
},
Statique.prototype.sendRes = function (res, statusCode, mimeType, content, otherHeaders) {
var self = this
, lMimeType = null
;
if (Mime.extensions[lMimeType = Mime.lookup(String(mimeType))] === mimeType) {
mimeType = lMimeType;
}
var headers = {
"Content-Type": mimeType || "plain/text"
, "Server": "Statique Server"
};
for (var h in otherHeaders) {
headers[h] = otherHeaders[h] === undefined ? headers[h] : otherHeaders[h];
}
res.writeHead(statusCode, headers);
if (typeof content === "string" || content instanceof Buffer) {
res.end(content);