Skip to content

Commit 7f091c9

Browse files
allow number, string, object, boolean, and RegExp as valid query parameters in sync method
1 parent 80ce9dc commit 7f091c9

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
## Change log
22

3+
### Version: 3.25.2
4+
#### Date: April-02-2025
5+
##### Fix:
6+
- allow number, string, object, boolean, and RegExp as valid query parameters in sync method
7+
38
### Version: 3.25.1
49
#### Date: April-01-2025
510
##### Fix:

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "contentstack",
3-
"version": "3.25.1",
3+
"version": "3.25.2",
44
"description": "Contentstack Javascript SDK",
55
"homepage": "https://www.contentstack.com/",
66
"author": {

src/core/stack.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -603,9 +603,16 @@ export default class Stack {
603603

604604
if (params) {
605605
for (const key in params) {
606+
const value = params[key];
606607
if (params.hasOwnProperty(key)) {
607-
if (typeof params[key] !== "string" && typeof params[key] !== "number") {
608-
throw new Error(`Invalid parameter value for key "${key}": must be a string or number.`);
608+
if (
609+
typeof value !== "string" &&
610+
typeof value !== "number" &&
611+
typeof value !== "boolean" &&
612+
!(value instanceof RegExp) &&
613+
(typeof value !== "object" || value === null)
614+
) {
615+
throw new Error(`Invalid parameter value for key "${key}": must be a string, number, object, boolean, or RegExp.`);
609616
}
610617
this._query[key] = params[key];
611618
}

0 commit comments

Comments
 (0)