@mswjs/interceptors 0.25.5 → 0.25.6
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/node/RemoteHttpInterceptor.js +2 -2
- package/lib/node/RemoteHttpInterceptor.mjs +1 -1
- package/lib/node/{chunk-C3TKZUFL.js → chunk-44QGFZIT.js} +1 -1
- package/lib/node/{chunk-4B3HXVWT.mjs → chunk-Z7O2DO3X.mjs} +1 -1
- package/lib/node/interceptors/ClientRequest/index.js +2 -2
- package/lib/node/interceptors/ClientRequest/index.mjs +1 -1
- package/lib/node/presets/node.js +2 -2
- package/lib/node/presets/node.mjs +1 -1
- package/package.json +1 -1
- package/src/interceptors/ClientRequest/utils/createRequest.test.ts +19 -0
- package/src/interceptors/ClientRequest/utils/createRequest.ts +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _chunkUF7QIAQ5js = require('./chunk-UF7QIAQ5.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk44QGFZITjs = require('./chunk-44QGFZIT.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _chunkJCWVLTP7js = require('./chunk-JCWVLTP7.js');
|
|
@@ -24,7 +24,7 @@ var RemoteHttpInterceptor = class extends _chunkUF7QIAQ5js.BatchInterceptor {
|
|
|
24
24
|
super({
|
|
25
25
|
name: "remote-interceptor",
|
|
26
26
|
interceptors: [
|
|
27
|
-
new (0,
|
|
27
|
+
new (0, _chunk44QGFZITjs.ClientRequestInterceptor)(),
|
|
28
28
|
new (0, _chunkJCWVLTP7js.XMLHttpRequestInterceptor)()
|
|
29
29
|
]
|
|
30
30
|
});
|
|
@@ -144,7 +144,7 @@ function createRequest(clientRequest) {
|
|
|
144
144
|
const outgoingHeaders = clientRequest.getHeaders();
|
|
145
145
|
for (const headerName in outgoingHeaders) {
|
|
146
146
|
const headerValue = outgoingHeaders[headerName];
|
|
147
|
-
if (
|
|
147
|
+
if (typeof headerValue === "undefined") {
|
|
148
148
|
continue;
|
|
149
149
|
}
|
|
150
150
|
const valuesList = Array.prototype.concat([], headerValue);
|
|
@@ -144,7 +144,7 @@ function createRequest(clientRequest) {
|
|
|
144
144
|
const outgoingHeaders = clientRequest.getHeaders();
|
|
145
145
|
for (const headerName in outgoingHeaders) {
|
|
146
146
|
const headerValue = outgoingHeaders[headerName];
|
|
147
|
-
if (
|
|
147
|
+
if (typeof headerValue === "undefined") {
|
|
148
148
|
continue;
|
|
149
149
|
}
|
|
150
150
|
const valuesList = Array.prototype.concat([], headerValue);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk44QGFZITjs = require('../../chunk-44QGFZIT.js');
|
|
4
4
|
require('../../chunk-OGN3ZR35.js');
|
|
5
5
|
require('../../chunk-5PTPJLB7.js');
|
|
6
6
|
require('../../chunk-3XFLRXRY.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
exports.ClientRequestInterceptor =
|
|
9
|
+
exports.ClientRequestInterceptor = _chunk44QGFZITjs.ClientRequestInterceptor;
|
package/lib/node/presets/node.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk44QGFZITjs = require('../chunk-44QGFZIT.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkJCWVLTP7js = require('../chunk-JCWVLTP7.js');
|
|
@@ -12,7 +12,7 @@ require('../chunk-3XFLRXRY.js');
|
|
|
12
12
|
|
|
13
13
|
// src/presets/node.ts
|
|
14
14
|
var node_default = [
|
|
15
|
-
new (0,
|
|
15
|
+
new (0, _chunk44QGFZITjs.ClientRequestInterceptor)(),
|
|
16
16
|
new (0, _chunkJCWVLTP7js.XMLHttpRequestInterceptor)()
|
|
17
17
|
];
|
|
18
18
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mswjs/interceptors",
|
|
3
3
|
"description": "Low-level HTTP/HTTPS/XHR/fetch request interception library.",
|
|
4
|
-
"version": "0.25.
|
|
4
|
+
"version": "0.25.6",
|
|
5
5
|
"main": "./lib/node/index.js",
|
|
6
6
|
"module": "./lib/node/index.mjs",
|
|
7
7
|
"types": "./lib/node/index.d.ts",
|
|
@@ -122,4 +122,23 @@ it('creates a fetch Request with an empty username', async () => {
|
|
|
122
122
|
|
|
123
123
|
expect(request.headers.get('Authorization')).toBe(`Basic ${btoa(':password')}`)
|
|
124
124
|
expect(request.url).toBe('https://api.github.com/')
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
it('creates a fetch Request with falsy headers', async () => {
|
|
128
|
+
const clientRequest = new NodeClientRequest(
|
|
129
|
+
[
|
|
130
|
+
new URL('https://api.github.com'),
|
|
131
|
+
{ headers: { 'foo': 0, 'empty': '' }}
|
|
132
|
+
],
|
|
133
|
+
{
|
|
134
|
+
emitter,
|
|
135
|
+
logger,
|
|
136
|
+
}
|
|
137
|
+
)
|
|
138
|
+
clientRequest.write('')
|
|
139
|
+
|
|
140
|
+
const request = createRequest(clientRequest)
|
|
141
|
+
|
|
142
|
+
expect(request.headers.get('foo')).toBe('0')
|
|
143
|
+
expect(request.headers.get('empty')).toBe('')
|
|
125
144
|
})
|
|
@@ -10,7 +10,7 @@ export function createRequest(clientRequest: NodeClientRequest): Request {
|
|
|
10
10
|
for (const headerName in outgoingHeaders) {
|
|
11
11
|
const headerValue = outgoingHeaders[headerName]
|
|
12
12
|
|
|
13
|
-
if (
|
|
13
|
+
if (typeof headerValue === 'undefined') {
|
|
14
14
|
continue
|
|
15
15
|
}
|
|
16
16
|
|