@nxtedition/nxt-undici 1.0.0 → 1.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.
package/lib/index.js CHANGED
@@ -102,6 +102,12 @@ async function request(url, opts) {
102
102
  headers = opts.headers
103
103
  }
104
104
 
105
+ headers = {
106
+ 'request-id': xuid(),
107
+ 'user-agent': opts.userAgent ?? globalThis.userAgent,
108
+ ...headers,
109
+ }
110
+
105
111
  if (method === 'CONNECT') {
106
112
  throw new createError.MethodNotAllowed()
107
113
  }
@@ -117,11 +123,7 @@ async function request(url, opts) {
117
123
  url,
118
124
  method,
119
125
  body: opts.body,
120
- headers: {
121
- 'request-id': xuid(),
122
- 'user-agent': opts.userAgent ?? globalThis.userAgent,
123
- ...headers,
124
- },
126
+ headers,
125
127
  origin: url.origin,
126
128
  path: url.path ? url.path : url.search ? `${url.pathname}${url.search ?? ''}` : url.pathname,
127
129
  reset: opts.reset ?? false,
@@ -147,7 +147,7 @@ class Handler {
147
147
  },
148
148
  }
149
149
 
150
- this.opts.loggerdebug('retrying response body')
150
+ this.opts.logger?.debug('retrying response body')
151
151
  }
152
152
  }
153
153
 
@@ -79,7 +79,7 @@ class Handler {
79
79
  this.handler.onError(err)
80
80
  })
81
81
 
82
- this.opts.loggerdebug('retrying response')
82
+ this.opts.logger?.debug('retrying response')
83
83
  }
84
84
  }
85
85
 
@@ -93,7 +93,7 @@ class Handler {
93
93
  })
94
94
  this.retryPromise = null
95
95
 
96
- this.opts.loggerdebug('retrying response status')
96
+ this.opts.logger?.debug('retrying response status')
97
97
  }
98
98
  }
99
99
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/nxt-undici",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "main": "lib/index.js",
@@ -13,5 +13,55 @@
13
13
  "lru-cache": "^10.0.1",
14
14
  "undici": "^5.26.4",
15
15
  "xuid": "^4.1.2"
16
+ },
17
+ "devDependencies": {
18
+ "@types/node": "^20.8.2",
19
+ "eslint": "^8.50.0",
20
+ "eslint-config-prettier": "^9.0.0",
21
+ "eslint-config-standard": "^17.0.0",
22
+ "husky": "^8.0.3",
23
+ "lint-staged": "^14.0.1",
24
+ "pinst": "^3.0.0",
25
+ "prettier": "^3.0.3",
26
+ "tap": "^18.4.2"
27
+ },
28
+ "scripts": {
29
+ "prepare": "husky install",
30
+ "prepublishOnly": "pinst --disable",
31
+ "postpublish": "pinst --enable",
32
+ "test": "tap test"
33
+ },
34
+ "lint-staged": {
35
+ "*.{js,jsx,md,ts}": [
36
+ "eslint",
37
+ "prettier --write"
38
+ ]
39
+ },
40
+ "prettier": {
41
+ "printWidth": 100,
42
+ "semi": false,
43
+ "singleQuote": true
44
+ },
45
+ "eslintConfig": {
46
+ "parserOptions": {
47
+ "ecmaFeatures": {
48
+ "ecmaVersion": 2020
49
+ }
50
+ },
51
+ "extends": [
52
+ "standard",
53
+ "prettier",
54
+ "prettier/prettier"
55
+ ],
56
+ "rules": {
57
+ "quotes": [
58
+ "error",
59
+ "single",
60
+ {
61
+ "avoidEscape": true,
62
+ "allowTemplateLiterals": true
63
+ }
64
+ ]
65
+ }
16
66
  }
17
67
  }