nock 15.0.0-beta.10 → 15.0.0-beta.12

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 (39) hide show
  1. package/dist/index.d.ts +60 -0
  2. package/dist/index.js +109 -0
  3. package/dist/lib/back.d.ts +44 -0
  4. package/{lib → dist/lib}/back.js +111 -84
  5. package/dist/lib/common.d.ts +27 -0
  6. package/{lib → dist/lib}/common.js +75 -190
  7. package/dist/lib/debug.d.ts +9 -0
  8. package/dist/lib/debug.js +17 -0
  9. package/dist/lib/global_emitter.d.ts +11 -0
  10. package/dist/lib/global_emitter.js +13 -0
  11. package/dist/lib/handle-request.d.ts +2 -0
  12. package/{lib → dist/lib}/handle-request.js +20 -39
  13. package/dist/lib/intercept.d.ts +25 -0
  14. package/{lib → dist/lib}/intercept.js +92 -81
  15. package/dist/lib/interceptor.d.ts +44 -0
  16. package/{lib → dist/lib}/interceptor.js +201 -122
  17. package/dist/lib/interceptors/builtin.d.ts +3 -0
  18. package/{lib → dist/lib}/interceptors/builtin.js +15 -20
  19. package/dist/lib/interceptors/undici.d.ts +3 -0
  20. package/{lib → dist/lib}/interceptors/undici.js +24 -21
  21. package/dist/lib/match_body.d.ts +1 -0
  22. package/{lib → dist/lib}/match_body.js +20 -27
  23. package/dist/lib/playback_interceptor.d.ts +8 -0
  24. package/{lib → dist/lib}/playback_interceptor.js +51 -61
  25. package/dist/lib/recorder.d.ts +13 -0
  26. package/{lib → dist/lib}/recorder.js +59 -59
  27. package/dist/lib/scope.d.ts +59 -0
  28. package/{lib → dist/lib}/scope.js +158 -87
  29. package/dist/lib/stringify.d.ts +24 -0
  30. package/{lib → dist/lib}/stringify.js +8 -20
  31. package/dist/lib/utils/node/index.d.ts +4 -0
  32. package/dist/lib/utils/node/index.js +16 -0
  33. package/package.json +22 -17
  34. package/index.js +0 -55
  35. package/lib/create_response.js +0 -53
  36. package/lib/debug.js +0 -12
  37. package/lib/global_emitter.js +0 -5
  38. package/lib/utils/node/index.js +0 -33
  39. package/types/index.d.ts +0 -323
@@ -0,0 +1,60 @@
1
+ import type { Options, Definition } from './lib/scope.ts';
2
+ import type { BackOptions, BackContext, BackMode, Back, InterceptorSurface } from './lib/back.ts';
3
+ import type { RecorderOptions } from './lib/recorder.ts';
4
+ import type { InterceptorMatchResult } from './lib/global_emitter.ts';
5
+ import type { DataMatcher, DataMatcherArray, DataMatcherMap, RequestBodyMatcher, RequestHeaderMatcher, Body, ReplyBody, ReplyHeaderFunction, ReplyHeaderValue, ReplyHeaders, StatusCode, ReplyFnResult, Interceptor } from './lib/interceptor.ts';
6
+ import type { Scope } from './lib/scope.ts';
7
+ import { removeAll } from './lib/intercept.ts';
8
+ declare function nock(basePath: string | RegExp | URL, options?: Options): Scope;
9
+ declare namespace nock {
10
+ var activate: typeof import("./lib/intercept.ts").activate;
11
+ var isActive: () => boolean;
12
+ var isDone: typeof import("./lib/intercept.ts").isDone;
13
+ var pendingMocks: typeof import("./lib/intercept.ts").pendingMocks;
14
+ var activeMocks: typeof import("./lib/intercept.ts").activeMocks;
15
+ var removeInterceptor: typeof import("./lib/intercept.ts").removeInterceptor;
16
+ var disableNetConnect: typeof import("./lib/intercept.ts").disableNetConnect;
17
+ var enableNetConnect: typeof import("./lib/intercept.ts").enableNetConnect;
18
+ var cleanAll: typeof removeAll;
19
+ var abortPendingRequests: typeof import("./lib/common.ts").removeAllTimers;
20
+ var load: typeof import("./lib/scope.ts").load;
21
+ var loadDefs: typeof import("./lib/scope.ts").loadDefs;
22
+ var define: typeof import("./lib/scope.ts").define;
23
+ var emitter: import("events")<{
24
+ 'no match': [req: Request, interceptorResults?: InterceptorMatchResult[]];
25
+ }>;
26
+ var recorder: {
27
+ rec: typeof import("./lib/recorder.ts").record;
28
+ clear: typeof import("./lib/recorder.ts").clear;
29
+ play: typeof import("./lib/recorder.ts").outputs;
30
+ };
31
+ var restore: typeof import("./lib/recorder.ts").restore;
32
+ var back: typeof import("./lib/back.ts").default;
33
+ var getGetRequestBody: typeof import("./lib/utils/node/index.ts").getGetRequestBody;
34
+ }
35
+ export default nock;
36
+ declare namespace nock {
37
+ export type { Scope };
38
+ export type { Interceptor };
39
+ export type { Options };
40
+ export type { Definition };
41
+ export type { BackMode };
42
+ export type { BackContext };
43
+ export type { BackOptions };
44
+ export type { RecorderOptions };
45
+ export type { InterceptorSurface };
46
+ export type { InterceptorMatchResult };
47
+ export type { DataMatcher };
48
+ export type { DataMatcherArray };
49
+ export type { DataMatcherMap };
50
+ export type { RequestBodyMatcher };
51
+ export type { RequestHeaderMatcher };
52
+ export type { Body };
53
+ export type { ReplyBody };
54
+ export type { ReplyHeaderFunction };
55
+ export type { ReplyHeaderValue };
56
+ export type { ReplyHeaders };
57
+ export type { StatusCode };
58
+ export type { ReplyFnResult };
59
+ export type { Back };
60
+ }
package/dist/index.js ADDED
@@ -0,0 +1,109 @@
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+ import back from './lib/back.js'
29
+ import emitter from './lib/global_emitter.js'
30
+ import {
31
+ activate,
32
+ isActive,
33
+ isDone,
34
+ isOn,
35
+ pendingMocks,
36
+ activeMocks,
37
+ removeInterceptor,
38
+ disableNetConnect,
39
+ enableNetConnect,
40
+ removeAll,
41
+ abortPendingRequests,
42
+ } from './lib/intercept.js'
43
+ import * as recorder from './lib/recorder.js'
44
+ import { Scope as ScopeClass, load, loadDefs, define } from './lib/scope.js'
45
+ import { getGetRequestBody } from './lib/utils/node/index.js'
46
+
47
+ function nock(basePath , options ) {
48
+ return new ScopeClass(basePath, options)
49
+ }
50
+
51
+ nock.activate = activate
52
+ nock.isActive = isActive
53
+ nock.isDone = isDone
54
+ nock.pendingMocks = pendingMocks
55
+ nock.activeMocks = activeMocks
56
+ nock.removeInterceptor = removeInterceptor
57
+ nock.disableNetConnect = disableNetConnect
58
+ nock.enableNetConnect = enableNetConnect
59
+ nock.cleanAll = removeAll
60
+ nock.abortPendingRequests = abortPendingRequests
61
+ nock.load = load
62
+ nock.loadDefs = loadDefs
63
+ nock.define = define
64
+ nock.emitter = emitter
65
+ nock.recorder = {
66
+ rec: recorder.record,
67
+ clear: recorder.clear,
68
+ play: recorder.outputs,
69
+ }
70
+ nock.restore = recorder.restore
71
+ nock.back = back
72
+ nock.getGetRequestBody = getGetRequestBody
73
+
74
+ export default nock
75
+
76
+ // Re-export types into the nock namespace so consumers can use nock.Scope, nock.Options, etc.
77
+
78
+
79
+
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+ // We always activate Nock on import, overriding the globals.
104
+ // Setting the Back mode "activates" Nock by overriding the global entries in the `http/s` modules.
105
+ // If Nock Back is configured, we need to honor that setting for backward compatibility,
106
+ // otherwise we rely on Nock Back's default initializing side effect.
107
+ if (isOn()) {
108
+ back.setMode(process.env.NOCK_BACK_MODE || 'dryrun')
109
+ }
@@ -0,0 +1,44 @@
1
+ import type { Scope } from './scope.ts';
2
+ import type { Definition } from './scope.ts';
3
+ import type { RecorderOptions } from './recorder.ts';
4
+ export type BackMode = 'wild' | 'dryrun' | 'record' | 'update' | 'lockdown';
5
+ export interface BackOptions {
6
+ before?: (def: Definition) => void;
7
+ after?: (scope: Scope) => void;
8
+ afterRecord?: (defs: Definition[]) => Definition[] | string;
9
+ recorder?: RecorderOptions;
10
+ }
11
+ declare namespace Back {
12
+ let fixtures: string | null;
13
+ let currentMode: string;
14
+ }
15
+ declare function Back(fixtureName: string, nockedFn: (nockDone: () => void) => void): void;
16
+ declare function Back(fixtureName: string, options: BackOptions, nockedFn: (nockDone: () => void) => void): void;
17
+ declare function Back(fixtureName: string, options?: BackOptions): Promise<{
18
+ nockDone: () => void;
19
+ context: BackContext;
20
+ }>;
21
+ declare namespace Back {
22
+ var setMode: (mode: string) => void;
23
+ }
24
+ declare function load(fixture?: string, options?: BackOptions | Record<string, any>): {
25
+ isLoaded: boolean;
26
+ isRecording: boolean;
27
+ scopes: Scope[];
28
+ assertScopesFinished: () => void;
29
+ query: () => {
30
+ method: string;
31
+ uri: string | RegExp | ((path: string) => boolean);
32
+ basePath: string | RegExp;
33
+ path: string | RegExp | ((path: string) => boolean);
34
+ queries: boolean | Record<string, any> | ((queryObject: Record<string, any>) => boolean) | null;
35
+ counter: number;
36
+ body: any;
37
+ statusCode: number | null | undefined;
38
+ optional: boolean;
39
+ }[];
40
+ };
41
+ export type BackContext = Omit<ReturnType<typeof load>, 'isRecording'>;
42
+ export type InterceptorSurface = ReturnType<BackContext['query']>[number];
43
+ export type Back = typeof Back;
44
+ export default Back;
@@ -1,42 +1,62 @@
1
- 'use strict'
2
-
3
- const fs = require('node:fs')
4
- const assert = require('node:assert')
5
- const recorder = require('./recorder')
6
- const {
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+ import fs from 'node:fs'
22
+ import assert from 'node:assert'
23
+ import * as recorder from './recorder.js'
24
+ import {
7
25
  activate,
8
26
  disableNetConnect,
9
27
  enableNetConnect,
10
- removeAll: cleanAll,
11
- } = require('./intercept')
12
- const { loadDefs, define } = require('./scope')
13
- const { back: debug } = require('./debug')
14
- const { format } = require('node:util')
15
- const path = require('node:path')
16
-
17
- let _mode = null
18
-
19
- /**
20
- * nock the current function with the fixture given
21
- *
22
- * @param {string} fixtureName - the name of the fixture, e.x. 'foo.json'
23
- * @param {object} options - [optional] extra options for nock with, e.x. `{ assert: true }`
24
- * @param {function} nockedFn - [optional] callback function to be executed with the given fixture being loaded;
25
- * if defined the function will be called with context `{ scopes: loaded_nocks || [] }`
26
- * set as `this` and `nockDone` callback function as first and only parameter;
27
- * if not defined a promise resolving to `{nockDone, context}` where `context` is
28
- * aforementioned `{ scopes: loaded_nocks || [] }`
29
- *
30
- * List of options:
31
- *
32
- * @param {function} before - a preprocessing function, gets called before nock.define
33
- * @param {function} after - a postprocessing function, gets called after nock.define
34
- * @param {function} afterRecord - a postprocessing function, gets called after recording. Is passed the array
35
- * of scopes recorded and should return the array scopes to save to the fixture
36
- * @param {function} recorder - custom options to pass to the recorder
37
- *
38
- */
39
- function Back(fixtureName, options, nockedFn) {
28
+ removeAll as cleanAll,
29
+ } from './intercept.js'
30
+ import { loadDefs, define } from './scope.js'
31
+ import { back as debug } from './debug.js'
32
+ import { format } from 'node:util'
33
+ import path from 'node:path'
34
+
35
+ let _mode = null
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+ function Back(
56
+ fixtureName ,
57
+ options ,
58
+ nockedFn ,
59
+ ) {
40
60
  if (!Back.fixtures) {
41
61
  throw new Error(
42
62
  'Back requires nock.back.fixtures to be set\n' +
@@ -60,13 +80,13 @@ function Back(fixtureName, options, nockedFn) {
60
80
  }
61
81
  }
62
82
 
63
- _mode.setup()
83
+ ;(_mode ).setup()
64
84
 
65
- const fixture = path.join(Back.fixtures, fixtureName)
66
- const context = _mode.start(fixture, options)
85
+ const fixture = path.join(Back.fixtures , fixtureName)
86
+ const context = (_mode ).start(fixture, options)
67
87
 
68
88
  const nockDone = function () {
69
- _mode.finish(fixture, options, context)
89
+ ;(_mode ).finish(fixture, options, context)
70
90
  }
71
91
 
72
92
  debug('context:', context)
@@ -91,7 +111,7 @@ const wild = {
91
111
  },
92
112
 
93
113
  start: function () {
94
- return load() // don't load anything but get correct context
114
+ return load(undefined, undefined) // don't load anything but get correct context
95
115
  },
96
116
 
97
117
  finish: function () {
@@ -108,7 +128,7 @@ const dryrun = {
108
128
  enableNetConnect()
109
129
  },
110
130
 
111
- start: function (fixture, options) {
131
+ start: function (fixture , options ) {
112
132
  const contexts = load(fixture, options)
113
133
 
114
134
  enableNetConnect()
@@ -129,7 +149,7 @@ const record = {
129
149
  disableNetConnect()
130
150
  },
131
151
 
132
- start: function (fixture, options) {
152
+ start: function (fixture , options ) {
133
153
  if (!fs) {
134
154
  throw new Error('no fs')
135
155
  }
@@ -148,20 +168,24 @@ const record = {
148
168
  return context
149
169
  },
150
170
 
151
- finish: function (fixture, options, context) {
171
+ finish: function (
172
+ fixture ,
173
+ options ,
174
+ context ,
175
+ ) {
152
176
  if (context.isRecording) {
153
- let outputs = recorder.outputs()
177
+ let outputs = recorder.outputs()
154
178
 
155
179
  if (typeof options.afterRecord === 'function') {
156
180
  outputs = options.afterRecord(outputs)
157
181
  }
158
182
 
159
- outputs =
183
+ const data =
160
184
  typeof outputs === 'string' ? outputs : JSON.stringify(outputs, null, 4)
161
- debug('recorder outputs:', outputs)
185
+ debug('recorder outputs:', data)
162
186
 
163
187
  fs.mkdirSync(path.dirname(fixture), { recursive: true })
164
- fs.writeFileSync(fixture, outputs)
188
+ fs.writeFileSync(fixture, data)
165
189
  }
166
190
  },
167
191
  }
@@ -175,7 +199,7 @@ const update = {
175
199
  disableNetConnect()
176
200
  },
177
201
 
178
- start: function (fixture, options) {
202
+ start: function (fixture , options ) {
179
203
  if (!fs) {
180
204
  throw new Error('no fs')
181
205
  }
@@ -191,19 +215,19 @@ const update = {
191
215
  return context
192
216
  },
193
217
 
194
- finish: function (fixture, options) {
195
- let outputs = recorder.outputs()
218
+ finish: function (fixture , options ) {
219
+ let outputs = recorder.outputs()
196
220
 
197
221
  if (typeof options.afterRecord === 'function') {
198
222
  outputs = options.afterRecord(outputs)
199
223
  }
200
224
 
201
- outputs =
225
+ const data =
202
226
  typeof outputs === 'string' ? outputs : JSON.stringify(outputs, null, 4)
203
- debug('recorder outputs:', outputs)
227
+ debug('recorder outputs:', data)
204
228
 
205
229
  fs.mkdirSync(path.dirname(fixture), { recursive: true })
206
- fs.writeFileSync(fixture, outputs)
230
+ fs.writeFileSync(fixture, data)
207
231
  },
208
232
  }
209
233
 
@@ -216,7 +240,7 @@ const lockdown = {
216
240
  disableNetConnect()
217
241
  },
218
242
 
219
- start: function (fixture, options) {
243
+ start: function (fixture , options ) {
220
244
  return load(fixture, options)
221
245
  },
222
246
 
@@ -225,15 +249,17 @@ const lockdown = {
225
249
  },
226
250
  }
227
251
 
228
- function load(fixture, options) {
252
+ function load(fixture , options ) {
229
253
  const context = {
230
- scopes: [],
254
+ isLoaded: false,
255
+ isRecording: false,
256
+ scopes: [] ,
231
257
  assertScopesFinished: function () {
232
258
  assertScopes(this.scopes, fixture)
233
259
  },
234
260
  query: function () {
235
- const nested = this.scopes.map(scope =>
236
- scope.interceptors.map(interceptor => ({
261
+ return this.scopes.flatMap((scope ) =>
262
+ scope.interceptors.map((interceptor ) => ({
237
263
  method: interceptor.method,
238
264
  uri: interceptor.uri,
239
265
  basePath: interceptor.basePath,
@@ -245,17 +271,16 @@ function load(fixture, options) {
245
271
  optional: interceptor.optional,
246
272
  })),
247
273
  )
248
-
249
- return [].concat.apply([], nested)
250
274
  },
251
275
  }
252
276
 
253
277
  if (fixture && fixtureExists(fixture)) {
254
278
  let scopes = loadDefs(fixture)
255
- applyHook(scopes, options.before)
279
+
280
+ applyHook(scopes, options?.before)
256
281
 
257
282
  scopes = define(scopes)
258
- applyHook(scopes, options.after)
283
+ applyHook(scopes, options?.after)
259
284
 
260
285
  context.scopes = scopes
261
286
  context.isLoaded = true
@@ -264,21 +289,25 @@ function load(fixture, options) {
264
289
  return context
265
290
  }
266
291
 
267
- function removeFixture(fixture) {
292
+
293
+
294
+
295
+ function removeFixture(fixture ) {
268
296
  const context = {
269
- scopes: [],
270
- assertScopesFinished: function () {},
297
+ scopes: [] ,
298
+ assertScopesFinished: () => {},
299
+ isLoaded: false,
300
+ isRecording: false,
271
301
  }
272
302
 
273
303
  if (fixture && fixtureExists(fixture)) {
274
304
  /* istanbul ignore next - fs.unlinkSync is for node 10 support */
275
305
  fs.rmSync ? fs.rmSync(fixture) : fs.unlinkSync(fixture)
276
306
  }
277
- context.isLoaded = false
278
307
  return context
279
308
  }
280
309
 
281
- function applyHook(scopes, fn) {
310
+ function applyHook(items , fn ) {
282
311
  if (!fn) {
283
312
  return
284
313
  }
@@ -287,10 +316,10 @@ function applyHook(scopes, fn) {
287
316
  throw new Error('processing hooks must be a function')
288
317
  }
289
318
 
290
- scopes.forEach(fn)
319
+ items.forEach(fn )
291
320
  }
292
321
 
293
- function fixtureExists(fixture) {
322
+ function fixtureExists(fixture ) {
294
323
  if (!fs) {
295
324
  throw new Error('no fs')
296
325
  }
@@ -298,35 +327,31 @@ function fixtureExists(fixture) {
298
327
  return fs.existsSync(fixture)
299
328
  }
300
329
 
301
- function assertScopes(scopes, fixture) {
330
+ function assertScopes(scopes , fixture ) {
302
331
  const pending = scopes
303
- .filter(scope => !scope.isDone())
304
- .map(scope => scope.pendingMocks())
332
+ .filter((scope ) => !scope.isDone())
333
+ .map((scope ) => scope.pendingMocks())
305
334
 
306
335
  if (pending.length) {
307
336
  assert.fail(
308
337
  format(
309
338
  '%j was not used, consider removing %s to rerecord fixture',
310
- [].concat(...pending),
339
+ ([] ).concat(...pending),
311
340
  fixture,
312
341
  ),
313
342
  )
314
343
  }
315
344
  }
316
345
 
317
- const Modes = {
346
+ const Modes = {
318
347
  wild, // all requests go out to the internet, dont replay anything, doesnt record anything
319
-
320
348
  dryrun, // use recorded nocks, allow http calls, doesnt record anything, useful for writing new tests (default)
321
-
322
349
  record, // use recorded nocks, record new nocks
323
-
324
350
  update, // allow http calls, record all nocks, don't use recorded nocks
325
-
326
351
  lockdown, // use recorded nocks, disables all http calls even when not nocked, doesnt record
327
352
  }
328
353
 
329
- Back.setMode = function (mode) {
354
+ Back.setMode = function (mode ) {
330
355
  if (!(mode in Modes)) {
331
356
  throw new Error(`Unknown mode: ${mode}`)
332
357
  }
@@ -334,11 +359,13 @@ Back.setMode = function (mode) {
334
359
  Back.currentMode = mode
335
360
  debug('New nock back mode:', Back.currentMode)
336
361
 
337
- _mode = Modes[mode]
362
+ _mode = Modes[mode ]
338
363
  _mode.setup()
339
364
  }
340
365
 
341
- Back.fixtures = null
342
- Back.currentMode = null
366
+ Back.fixtures = null
367
+ Back.currentMode = ''
368
+
369
+
343
370
 
344
- module.exports = Back
371
+ export default Back
@@ -0,0 +1,27 @@
1
+ declare function normalizeRequestOptions(options: Record<string, any>): Record<string, any>;
2
+ declare function isUtf8Representable(buffer: ArrayBuffer | Buffer): boolean;
3
+ declare function normalizeOrigin(url: URL): string;
4
+ declare function stringifyRequest(request: Request, body: string): string;
5
+ declare function isContentEncoded(headers: Record<string, any>): boolean;
6
+ declare function contentEncoding(headers: Headers, encoder: 'gzip' | 'deflate'): boolean;
7
+ declare function isJSONContent(headers: Headers): boolean;
8
+ declare function headersFieldNamesToLowerCase(headers: Record<string, any>, throwOnDuplicate?: boolean): Record<string, any>;
9
+ declare const headersFieldsArrayToLowerCase: (headers: string[]) => string[];
10
+ declare function headersInputToRawArray(headers?: any[] | Map<string, any> | Record<string, any>): any[];
11
+ declare function headersArrayToObject(rawHeaders: any[]): Record<string, any>;
12
+ declare function deleteHeadersField(headers: Record<string, any>, fieldNameToDelete: string): void;
13
+ declare function forEachHeader(rawHeaders: any[], callback: (value: any, fieldName: any, index: number) => void): void;
14
+ declare function percentDecode(str: string): string;
15
+ declare function percentEncode(str: string): string;
16
+ declare function matchStringOrRegexp(target: string | null | undefined, pattern: string | RegExp): boolean;
17
+ declare function formatQueryValue(key: string, value: any, stringFormattingFn?: (s: string) => string): [string, any];
18
+ declare function isStream(obj: any): any;
19
+ declare const dataEqual: (expected: any, actual: any) => boolean;
20
+ declare const setTimeout: (callback: (...args: any[]) => any, ...timerArgs: any[]) => any;
21
+ declare const setImmediate: (callback: (...args: any[]) => any, ...timerArgs: any[]) => any;
22
+ declare function removeAllTimers(): void;
23
+ declare function isPlainObject(value: any): boolean;
24
+ declare const expand: (input: Record<string, any> | null | undefined) => Record<string, any> | null | undefined;
25
+ declare function decompressRequestBody(buffer: ArrayBuffer, contentEncoding: string): ArrayBuffer | NonSharedBuffer;
26
+ declare function convertHeadersToRaw(headers: Headers): string[];
27
+ export { contentEncoding, dataEqual, deleteHeadersField, expand, forEachHeader, formatQueryValue, headersArrayToObject, headersFieldNamesToLowerCase, headersFieldsArrayToLowerCase, headersInputToRawArray, isContentEncoded, isJSONContent, isPlainObject, isStream, isUtf8Representable, matchStringOrRegexp, normalizeOrigin, normalizeRequestOptions, percentDecode, percentEncode, removeAllTimers, setImmediate, setTimeout, stringifyRequest, decompressRequestBody, convertHeadersToRaw, };