orator 5.0.0 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +7 -7
  2. package/source/Orator.js +19 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orator",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "Unopinionated API http server abstraction - REST or IPC",
5
5
  "main": "source/Orator.js",
6
6
  "scripts": {
@@ -51,14 +51,14 @@
51
51
  },
52
52
  "homepage": "https://github.com/stevenvelozo/orator",
53
53
  "devDependencies": {
54
- "fable": "^3.0.143",
55
- "quackage": "^1.0.33"
54
+ "fable": "^3.0.147",
55
+ "quackage": "^1.0.36"
56
56
  },
57
57
  "dependencies": {
58
- "fable-serviceproviderbase": "^3.0.13",
59
- "finalhandler": "^1.2.0",
60
- "find-my-way": "^8.2.0",
58
+ "fable-serviceproviderbase": "^3.0.15",
59
+ "finalhandler": "^1.3.1",
60
+ "find-my-way": "^9.1.0",
61
61
  "orator-serviceserver-base": "^1.0.1",
62
- "serve-static": "^1.15.0"
62
+ "serve-static": "^1.16.2"
63
63
  }
64
64
  }
package/source/Orator.js CHANGED
@@ -59,6 +59,15 @@ class Orator extends libFableServiceProviderBase
59
59
  {
60
60
  this.options.Product = defaultOratorConfiguration.Product;
61
61
  }
62
+
63
+ // This is here because libMime has a breaking change from v1 to v2 and the lookup function was update to be getType per https://stackoverflow.com/a/60741078
64
+ // We don't want to introspect properties on this library every single time we need to check mime types.
65
+ // Therefore we are setting this boolean here and using it to branch.
66
+ this.oldLibMime = false;
67
+ if ('lookup' in libMime)
68
+ {
69
+ this.oldLibMime = true;
70
+ }
62
71
  }
63
72
 
64
73
  /**
@@ -355,7 +364,16 @@ class Orator extends libFableServiceProviderBase
355
364
 
356
365
  setMimeHeader(pFileName, pResponse)
357
366
  {
358
- let tmpHeader = libMime.lookup(pFileName);
367
+ let tmpHeader;
368
+
369
+ if (this.oldLibMime)
370
+ {
371
+ tmpHeader = libMime.lookup(pFileName);
372
+ }
373
+ else
374
+ {
375
+ tmpHeader = libMime.getType(pFileName);
376
+ }
359
377
 
360
378
  if (!tmpHeader)
361
379
  {