@nxtedition/lib 28.0.30 → 28.0.31

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/http.js +19 -1
  2. package/package.json +2 -2
package/http.js CHANGED
@@ -48,7 +48,8 @@ export class Context {
48
48
  #ac
49
49
  #logger
50
50
  #query
51
- #target;
51
+ #target
52
+ #priority;
52
53
 
53
54
  [kPendingIndex] = -1
54
55
 
@@ -60,6 +61,23 @@ export class Context {
60
61
  this.#req = req
61
62
  this.#res = res
62
63
  this.#logger = logger.child({ rid: this.#id })
64
+
65
+ const p = req.headers['nxt-priority']
66
+ if (!p) {
67
+ this.#priority = 1
68
+ } else if (p === '0' || p === 'low') {
69
+ this.#priority = 0
70
+ } else if (p === '1' || p === 'normal') {
71
+ this.#priority = 1
72
+ } else if (p === '2' || p === 'high') {
73
+ this.#priority = 2
74
+ } else {
75
+ throw new Error('Invalid nxt-priority header')
76
+ }
77
+ }
78
+
79
+ get priority() {
80
+ return this.#priority
63
81
  }
64
82
 
65
83
  get id() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "28.0.30",
3
+ "version": "28.0.31",
4
4
  "license": "UNLICENSED",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",
@@ -93,5 +93,5 @@
93
93
  "canvas": "^3.1.0",
94
94
  "rxjs": "^7.0.0"
95
95
  },
96
- "gitHead": "0f407ebce03f670f13a733240af2a733ca56eefc"
96
+ "gitHead": "b764a06e9dc3fcdce6d4e136086dc378e0acc772"
97
97
  }