File: fix-for-mime-2.diff

package info (click to toggle)
node-static 0.7.11%2B~0.7.7-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 224 kB
  • sloc: javascript: 841; makefile: 6
file content (27 lines) | stat: -rw-r--r-- 879 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Description: fix for node-mime ≥ 2
Author: Xavier Guimard <yadd@debian.org>
Forwarded: no
Last-Update: 2020-11-01

--- a/lib/node-static.js
+++ b/lib/node-static.js
@@ -341,7 +341,7 @@
 
 Server.prototype.respond = function (pathname, status, _headers, files, stat, req, res, finish) {
     var contentType = _headers['Content-Type'] ||
-                      mime.lookup(files[0]) ||
+                      mime.getType(files[0]) ||
                       'application/octet-stream';
 
     if(this.options.gzip) {
--- a/test/integration/node-static-test.js
+++ b/test/integration/node-static-test.js
@@ -305,7 +305,7 @@
       this.callback();
     },
     'should add woff' : function(error, response, body){
-      assert.equal(static.mime.lookup('woff'), 'application/font-woff');
+      assert.equal(static.mime.getType('woff'), 'application/font-woff');
     }
   }
 })