nock 13.2.5 → 13.2.8

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.
@@ -143,8 +143,11 @@ class InterceptedRequestRouter {
143
143
 
144
144
  // from docs: When write function is called with empty string or buffer, it does nothing and waits for more input.
145
145
  // However, actually implementation checks the state of finished and aborted before checking if the first arg is empty.
146
- handleWrite(buffer, encoding, callback) {
146
+ handleWrite(...args) {
147
147
  debug('request write')
148
+
149
+ let [buffer, encoding] = args
150
+
148
151
  const { req } = this
149
152
 
150
153
  if (req.finished) {
@@ -171,6 +174,9 @@ class InterceptedRequestRouter {
171
174
  }
172
175
  this.requestBodyBuffers.push(buffer)
173
176
 
177
+ // writable.write encoding param is optional
178
+ // so if callback is present it's the last argument
179
+ const callback = args.length > 1 ? args[args.length - 1] : undefined
174
180
  // can't use instanceof Function because some test runners
175
181
  // run tests in vm.runInNewContext where Function is not same
176
182
  // as that in the current context
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "testing",
8
8
  "isolation"
9
9
  ],
10
- "version": "13.2.5",
10
+ "version": "13.2.8",
11
11
  "author": "Pedro Teixeira <pedro.teixeira@gmail.com>",
12
12
  "repository": {
13
13
  "type": "git",
@@ -41,7 +41,7 @@
41
41
  "eslint-plugin-node": "^11.0.0",
42
42
  "eslint-plugin-promise": "^6.0.0",
43
43
  "form-data": "^4.0.0",
44
- "got": "^12.1.0",
44
+ "got": "^11.3.0",
45
45
  "mocha": "^9.1.3",
46
46
  "npm-run-all": "^4.1.5",
47
47
  "nyc": "^15.0.0",
package/types/index.d.ts CHANGED
@@ -228,8 +228,8 @@ declare namespace nock {
228
228
  }
229
229
 
230
230
  interface Definition {
231
- scope: string
232
- path: string
231
+ scope: string | RegExp
232
+ path: string | RegExp
233
233
  port?: number | string
234
234
  method?: string
235
235
  status?: number