@superhero/http-server 4.4.7 → 4.7.0

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.
@@ -0,0 +1,13 @@
1
+ export default
2
+ {
3
+ isValid(request, session)
4
+ {
5
+ const
6
+ header = request.headers['accept'],
7
+ lowerCased = header.toLowerCase(),
8
+ accept = lowerCased.split(';')[0].split('*')[0].trim()
9
+
10
+ return [session.route['criteria.accept']].flat().some(supported =>
11
+ supported.startsWith(accept) || accept.startsWith(supported.split('*')[0]))
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ export default
2
+ {
3
+ isValid(request, session)
4
+ {
5
+ const
6
+ header = request.headers['content-type'],
7
+ lowerCased = header.toLowerCase(),
8
+ contentType = lowerCased.split(';')[0].split('*')[0].trim()
9
+
10
+ return [session.route['criteria.content-type']].flat().some(supported =>
11
+ supported.startsWith(contentType) || contentType.startsWith(supported.split('*')[0]))
12
+ }
13
+ }
@@ -0,0 +1,7 @@
1
+ export default
2
+ {
3
+ isdValid(request, session)
4
+ {
5
+ return [session.route['criteria.method']].flat().includes(request.method)
6
+ }
7
+ }
package/index.js CHANGED
@@ -254,7 +254,7 @@ export default class HttpServer
254
254
  // non enumerable and non-configurable session properties
255
255
  downstream : { value:downstream },
256
256
  upstream : { value:upstream },
257
- abortion : { value:abortion }
257
+ abortion : { value:abortion },
258
258
  })
259
259
 
260
260
  Object.defineProperty(session, 'view', { enumerable: true, value: new View(session) })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superhero/http-server",
3
- "version": "4.4.7",
3
+ "version": "4.7.0",
4
4
  "description": "HTTP(S) server component supporting both HTTP 1.1 and HTTP 2.0",
5
5
  "keywords": [
6
6
  "http server",
@@ -22,18 +22,21 @@
22
22
  "./*/*/*/*/*": "./*/*/*/*/*.js",
23
23
  "./*/*/*/*/*/*": "./*/*/*/*/*/*.js"
24
24
  },
25
+ "scripts": {
26
+ "syntax-check": "syntax-check",
27
+ "test": "syntax-check; node --test --test-reporter=@superhero/audit/reporter --experimental-test-coverage"
28
+ },
25
29
  "dependencies": {
26
- "@superhero/router": "^4.1.9",
27
- "@superhero/deep": "^4.5.0",
28
- "@superhero/log": "^4.0.2",
29
- "@superhero/id-name-generator": "^4.0.0"
30
+ "@superhero/router": "4.7.0",
31
+ "@superhero/deep": "4.7.0",
32
+ "@superhero/log": "4.7.0",
33
+ "@superhero/id-name-generator": "4.7.0"
30
34
  },
31
35
  "devDependencies": {
32
- "@superhero/locator": "^4.4.5",
33
- "@superhero/http-request": "^4.0.10"
34
- },
35
- "scripts": {
36
- "test": "node --trace-warnings --test --experimental-test-coverage"
36
+ "@superhero/audit": "4.7.0",
37
+ "@superhero/syntax-check": "0.0.2",
38
+ "@superhero/locator": "4.7.0",
39
+ "@superhero/http-request": "4.7.0"
37
40
  },
38
41
  "author": {
39
42
  "name": "Erik Landvall",
@@ -41,6 +44,6 @@
41
44
  },
42
45
  "repository": {
43
46
  "type": "git",
44
- "url": "git+https://github.com/superhero/http-server.git"
47
+ "url": "https://github.com/superhero/http-server.git"
45
48
  }
46
49
  }