msw 0.36.4 → 0.36.5
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/esm/RequestHandler-deps.js +5 -6
- package/lib/esm/mockServiceWorker.js +1 -1
- package/lib/iife/index.js +2 -2
- package/lib/iife/mockServiceWorker.js +1 -1
- package/lib/umd/index.js +228 -93
- package/lib/umd/mockServiceWorker.js +1 -1
- package/native/lib/index.js +5 -6
- package/node/lib/index.js +5 -6
- package/package.json +13 -4
package/native/lib/index.js
CHANGED
|
@@ -977,11 +977,12 @@ function parseMultipartData(data, headers) {
|
|
|
977
977
|
* Parses a given request/response body based on the "Content-Type" header.
|
|
978
978
|
*/
|
|
979
979
|
function parseBody(body, headers) {
|
|
980
|
+
var _a;
|
|
980
981
|
// Return whatever falsey body value is given.
|
|
981
982
|
if (!body) {
|
|
982
983
|
return body;
|
|
983
984
|
}
|
|
984
|
-
const contentType = (headers === null || headers === void 0 ? void 0 : headers.get('content-type')) || '';
|
|
985
|
+
const contentType = ((_a = headers === null || headers === void 0 ? void 0 : headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || '';
|
|
985
986
|
// If the body has a Multipart Content-Type
|
|
986
987
|
// parse it into an object.
|
|
987
988
|
const hasMultipartContent = contentType.startsWith('multipart/form-data');
|
|
@@ -1224,11 +1225,9 @@ var InvariantError = /** @class */ (function (_super) {
|
|
|
1224
1225
|
_this.name = 'Invariant Violation';
|
|
1225
1226
|
_this.message = format_1.format.apply(void 0, __spreadArray([message], positionals));
|
|
1226
1227
|
if (_this.stack) {
|
|
1227
|
-
var
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
.slice(STACK_FRAMES_TO_IGNORE)
|
|
1231
|
-
.join('\n');
|
|
1228
|
+
var nextStack = _this.stack.split('\n');
|
|
1229
|
+
nextStack.splice(1, STACK_FRAMES_TO_IGNORE);
|
|
1230
|
+
_this.stack = nextStack.join('\n');
|
|
1232
1231
|
}
|
|
1233
1232
|
return _this;
|
|
1234
1233
|
}
|
package/node/lib/index.js
CHANGED
|
@@ -2863,11 +2863,12 @@ function parseMultipartData(data, headers) {
|
|
|
2863
2863
|
* Parses a given request/response body based on the "Content-Type" header.
|
|
2864
2864
|
*/
|
|
2865
2865
|
function parseBody(body, headers) {
|
|
2866
|
+
var _a;
|
|
2866
2867
|
// Return whatever falsey body value is given.
|
|
2867
2868
|
if (!body) {
|
|
2868
2869
|
return body;
|
|
2869
2870
|
}
|
|
2870
|
-
const contentType = (headers === null || headers === void 0 ? void 0 : headers.get('content-type')) || '';
|
|
2871
|
+
const contentType = ((_a = headers === null || headers === void 0 ? void 0 : headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || '';
|
|
2871
2872
|
// If the body has a Multipart Content-Type
|
|
2872
2873
|
// parse it into an object.
|
|
2873
2874
|
const hasMultipartContent = contentType.startsWith('multipart/form-data');
|
|
@@ -3110,11 +3111,9 @@ var InvariantError = /** @class */ (function (_super) {
|
|
|
3110
3111
|
_this.name = 'Invariant Violation';
|
|
3111
3112
|
_this.message = format_1.format.apply(void 0, __spreadArray([message], positionals));
|
|
3112
3113
|
if (_this.stack) {
|
|
3113
|
-
var
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
.slice(STACK_FRAMES_TO_IGNORE)
|
|
3117
|
-
.join('\n');
|
|
3114
|
+
var nextStack = _this.stack.split('\n');
|
|
3115
|
+
nextStack.splice(1, STACK_FRAMES_TO_IGNORE);
|
|
3116
|
+
_this.stack = nextStack.join('\n');
|
|
3118
3117
|
}
|
|
3119
3118
|
return _this;
|
|
3120
3119
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "msw",
|
|
3
|
-
"version": "0.36.
|
|
3
|
+
"version": "0.36.5",
|
|
4
4
|
"description": "Seamless REST/GraphQL API mocking library for browser and Node.js.",
|
|
5
5
|
"main": "lib/umd/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -18,9 +18,8 @@
|
|
|
18
18
|
"test:integration": "jest --config=test/jest.config.js --maxWorkers=3",
|
|
19
19
|
"test:smoke": "config/scripts/smoke.sh",
|
|
20
20
|
"test:ts": "tsc -p test/typings/tsconfig.json",
|
|
21
|
-
"
|
|
21
|
+
"prepare": "yarn simple-git-hooks init",
|
|
22
22
|
"prepublishOnly": "yarn lint && yarn test:unit && yarn build && yarn test:integration",
|
|
23
|
-
"prepare": "husky install",
|
|
24
23
|
"postinstall": "node -e \"try{require('./config/scripts/postinstall')}catch(e){}\""
|
|
25
24
|
},
|
|
26
25
|
"lint-staged": {
|
|
@@ -88,6 +87,8 @@
|
|
|
88
87
|
"devDependencies": {
|
|
89
88
|
"@babel/core": "^7.16.0",
|
|
90
89
|
"@babel/preset-env": "^7.16.4",
|
|
90
|
+
"@commitlint/cli": "^16.0.2",
|
|
91
|
+
"@commitlint/config-conventional": "^16.0.0",
|
|
91
92
|
"@open-draft/test-server": "^0.2.3",
|
|
92
93
|
"@rollup/plugin-commonjs": "^19.0.0",
|
|
93
94
|
"@rollup/plugin-inject": "^4.0.3",
|
|
@@ -104,17 +105,19 @@
|
|
|
104
105
|
"@typescript-eslint/parser": "^4.28.3",
|
|
105
106
|
"babel-loader": "^8.2.3",
|
|
106
107
|
"babel-minify": "^0.5.1",
|
|
108
|
+
"commitizen": "^4.2.4",
|
|
107
109
|
"cross-env": "^7.0.3",
|
|
108
110
|
"cross-fetch": "^3.1.4",
|
|
111
|
+
"cz-conventional-changelog": "3.3.0",
|
|
109
112
|
"eslint": "^7.30.0",
|
|
110
113
|
"eslint-config-prettier": "^8.3.0",
|
|
111
114
|
"eslint-plugin-prettier": "^3.4.0",
|
|
112
115
|
"fs-extra": "^10.0.0",
|
|
113
116
|
"fs-teardown": "^0.3.0",
|
|
114
|
-
"husky": "^5.1.1",
|
|
115
117
|
"jest": "26",
|
|
116
118
|
"json-bigint": "^1.0.0",
|
|
117
119
|
"lint-staged": "^11.0.1",
|
|
120
|
+
"outvariant": "^1.2.1",
|
|
118
121
|
"page-with": "^0.5.0",
|
|
119
122
|
"prettier": "^2.3.2",
|
|
120
123
|
"regenerator-runtime": "^0.13.9",
|
|
@@ -122,6 +125,7 @@
|
|
|
122
125
|
"rollup": "^2.60.2",
|
|
123
126
|
"rollup-plugin-terser": "^7.0.2",
|
|
124
127
|
"rollup-plugin-typescript2": "^0.30.0",
|
|
128
|
+
"simple-git-hooks": "^2.7.0",
|
|
125
129
|
"ts-jest": "26",
|
|
126
130
|
"ts-loader": "^9.2.6",
|
|
127
131
|
"ts-node": "^10.1.0",
|
|
@@ -132,5 +136,10 @@
|
|
|
132
136
|
},
|
|
133
137
|
"resolutions": {
|
|
134
138
|
"chokidar": "3.4.1"
|
|
139
|
+
},
|
|
140
|
+
"config": {
|
|
141
|
+
"commitizen": {
|
|
142
|
+
"path": "./node_modules/cz-conventional-changelog"
|
|
143
|
+
}
|
|
135
144
|
}
|
|
136
145
|
}
|