Skip to content

Commit 5010f37

Browse files
authored
Merge pull request #51 from contentstack/bugfix/ie11-node-fetch-error
Bugfix: IE11 node fetch error
2 parents 5b84a4d + e8390dc commit 5010f37

11 files changed

Lines changed: 62 additions & 44 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11

2+
3+
### Version: 3.13.1
4+
#### Date: Apr-16-2021
5+
##### Bug fix:
6+
- IE 11 request method issue resolved
7+
28
### Version: 3.13.0
3-
#### Date:
9+
#### Date: Apr-05-2021
410

511
##### Update API:
612
- [Query]: Added support for method includeEmbeddedItems

package-lock.json

Lines changed: 18 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "contentstack",
3-
"version": "3.13.0",
3+
"version": "3.13.1",
44
"description": "Contentstack Javascript SDK",
55
"homepage": "https://www.contentstack.com/",
66
"author": {
@@ -10,7 +10,7 @@
1010
"main": "dist/node/contentstack.js",
1111
"browser": "dist/web/contentstack.js",
1212
"types": "./index.d.ts",
13-
"_id": "contentstack@3.13.0",
13+
"_id": "contentstack@3.13.1",
1414
"scripts": {
1515
"test": "npm run test:e2e && npm run test:typescript",
1616
"test:e2e": "istanbul cover tape test/index.js | tap-html --out ./tap-html.html",
@@ -22,7 +22,8 @@
2222
"buildnativescript": "webpack --config webpack/webpack.nativescript.js",
2323
"build": "NODE_ENV=production && npm run buildnode && npm run buildweb && npm run buildreactnative && npm run buildnativescript",
2424
"generate-docs": "node_modules/.bin/jsdoc --configure docs-config.json --verbose",
25-
"prepare": "npm run build"
25+
"prepare": "npm run build",
26+
"pretest": "npm run build"
2627
},
2728
"repository": {
2829
"type": "git",
@@ -53,14 +54,14 @@
5354
],
5455
"dist": {
5556
"shasum": "a328ed07240476a26b31a23261355dc929e1da63",
56-
"tarball": "https://registry.npmjs.org/contentstack/-/contentstack-3.13.0.tgz"
57+
"tarball": "https://registry.npmjs.org/contentstack/-/contentstack-3.13.1.tgz"
5758
},
5859
"license": "MIT",
5960
"directories": {},
60-
"_resolved": "https://registry.npmjs.org/contentstack/-/contentstack-3.13.0.tgz",
61+
"_resolved": "https://registry.npmjs.org/contentstack/-/contentstack-3.13.1.tgz",
6162
"_npmOperationalInternal": {
6263
"host": "packages-18-east.internal.npmjs.com",
63-
"tmp": "tmp/contentstack-3.13.0.tgz_1477830884275_0.9869455888401717"
64+
"tmp": "tmp/contentstack-3.13.1.tgz_1477830884275_0.9869455888401717"
6465
},
6566
"devDependencies": {
6667
"@types/jest": "^26.0.13",
@@ -99,7 +100,7 @@
99100
"dependencies": {
100101
"@contentstack/utils": "1.0.0",
101102
"es6-promise": "4.1.1",
102-
"localStorage": "1.0.3",
103-
"node-fetch": "^2.6.1"
103+
"isomorphic-fetch": "^3.0.0",
104+
"localStorage": "1.0.3"
104105
}
105106
}

src/core/lib/request.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ async function safeParseJSON(response) {
6161
const body = await response.text();
6262
}
6363
function fetchRetry(url, headers, retryDelay = 300, retryLimit = 5, fetchOptions, resolve, reject) {
64-
var option = Object.assign({
64+
var option = Utils.mergeDeep({
6565
method: 'GET',
6666
headers: headers,
6767
timeout: 30000,

src/core/lib/utils.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,7 @@ export function sendRequest(queryObject, options) {
238238
let tojson = (typeof self.tojson !== 'undefined') ? self.tojson : false;
239239
let isSingle = (self.entry_uid || self.singleEntry || self.asset_uid) ? true : false;
240240
let hashQuery = getHash(parseQueryFromParams(self, isSingle, tojson));
241-
if (queryObject.requestParams.url.includes(config.urls.sync)) {
242-
cachePolicy = -1;
243-
}
241+
244242
/**
245243
for new api v3
246244
*/

src/core/modules/assets.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export default class Assets {
118118
query: this._query
119119
}
120120
}
121-
var options = Object.assign({}, this.fetchOptions, fetchOptions);
121+
var options = Utils.mergeDeep({}, this.fetchOptions, fetchOptions);
122122
return Utils.sendRequest(this, options);
123123
} else {
124124
console.error("Kindly provide an asset uid. e.g. .Assets('bltsomething123')");

src/core/modules/entry.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ export default class Entry {
341341
query: this._query
342342
}
343343
};
344-
var options = Object.assign({}, this.fetchOptions, fetchOptions);
344+
var options = Utils.mergeDeep({}, this.fetchOptions, fetchOptions);
345345
return Utils.sendRequest(this, options);
346346
} else {
347347
console.error("Kindly provide an entry uid. e.g. .Entry('bltsomething123')");

src/core/modules/query.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ export default class Query extends Entry {
757757
query: this._query
758758
}
759759
};
760-
var options = Object.assign({}, this.fetchOptions, fetchOptions);
760+
var options = Utils.mergeDeep({}, this.fetchOptions, fetchOptions);
761761
return Utils.sendRequest(this, options);
762762
}
763763

@@ -790,7 +790,7 @@ export default class Query extends Entry {
790790
query: this._query
791791
}
792792
};
793-
var options = Object.assign({}, this.fetchOptions);
793+
var options = Utils.mergeDeep({}, this.fetchOptions);
794794
return Utils.sendRequest(this, options);
795795
}
796796

src/core/stack.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ export default class Stack {
5757
return false
5858
}
5959
};
60-
this.config = Object.assign({}, config)
60+
this.config = Utils.mergeDeep({}, config)
6161

6262
if(stack_arguments[0].region && stack_arguments[0].region !== undefined && stack_arguments[0].region !== "us") {
6363
this.config['host'] = stack_arguments[0].region+"-"+"cdn.contentstack.com";
6464
}
6565

6666
if (stack_arguments[0].fetchOptions && stack_arguments[0].fetchOptions !== undefined) {
67-
this.fetchOptions = Object.assign(this.fetchOptions, stack_arguments[0].fetchOptions);
67+
this.fetchOptions = Utils.mergeDeep(this.fetchOptions, stack_arguments[0].fetchOptions);
6868
}
6969

7070
this.cachePolicy = CacheProvider.policies.IGNORE_CACHE;
@@ -107,7 +107,7 @@ export default class Stack {
107107
if(typeof stack_arguments[3] === "string" && stack_arguments[3] !== undefined && stack_arguments[3] !== "us") {
108108
this.config['host'] = stack_arguments[3]+"-"+"cdn.contentstack.com";
109109
} else if (typeof stack_arguments[3] === 'object') {
110-
this.fetchOptions = Object.assign(this.fetchOptions, stack_arguments[3]);
110+
this.fetchOptions = Utils.mergeDeep(this.fetchOptions, stack_arguments[3]);
111111
}
112112
}
113113
return this;
@@ -126,11 +126,11 @@ export default class Stack {
126126
if(typeof stack_arguments[3] === "string" && stack_arguments[3] !== undefined && stack_arguments[3] !== "us") {
127127
this.config['host'] = stack_arguments[3]+"-"+"cdn.contentstack.com";
128128
} else if (typeof stack_arguments[3] === 'object') {
129-
this.fetchOptions = Object.assign(this.fetchOptions, stack_arguments[3]);
129+
this.fetchOptions = Utils.mergeDeep(this.fetchOptions, stack_arguments[3]);
130130
}
131131
}
132132
if (stack_arguments[4] && typeof stack_arguments[4] === 'object') {
133-
this.fetchOptions = Object.assign(this.fetchOptions, stack_arguments[4]);
133+
this.fetchOptions = Utils.mergeDeep(this.fetchOptions, stack_arguments[4]);
134134
}
135135
return this;
136136
default:
@@ -353,7 +353,7 @@ export default class Stack {
353353
environment: this.environment
354354
}
355355
};
356-
var options = Object.assign({}, this.fetchOptions, fetchOptions);
356+
var options = Utils.mergeDeep({}, this.fetchOptions, fetchOptions);
357357
return Request(result, options);
358358
}
359359

@@ -497,7 +497,7 @@ export default class Stack {
497497

498498
sync(params, fetchOptions) {
499499
this._query = {};
500-
this._query = Object.assign(this._query, params);
500+
this._query = Utils.mergeDeep(this._query, params);
501501
this.requestParams = {
502502
method: 'POST',
503503
headers: this.headers,
@@ -507,7 +507,7 @@ export default class Stack {
507507
query: this._query
508508
}
509509
}
510-
var options = Object.assign({}, this.fetchOptions, fetchOptions);
510+
var options = Utils.mergeDeep({}, this.fetchOptions, fetchOptions);
511511
return Utils.sendRequest(this, options);
512512
}
513513

src/runtime/web/http.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import ES6Promise from 'es6-promise';
2-
import fetch from 'node-fetch';
3-
2+
import fetch from 'isomorphic-fetch';
43
ES6Promise.polyfill();
54

65
export default fetch;

0 commit comments

Comments
 (0)