Skip to content

Commit 3a0bad1

Browse files
authored
fix(javascript): use proper null check instead of truthiness for required params (#6498)
1 parent 45b42dd commit 3a0bad1

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export function validateRequired(field: string, method: string, value: unknown): void {
2-
if (value === null || value === undefined || (typeof value === 'string' && value.length === 0)) {
2+
if (value == null || (typeof value === 'string' && value.length === 0)) {
33
throw new Error(`Parameter \`${field}\` is required when calling \`${method}\`.`);
44
}
55
}

‎tests/CTS/requests/search/getTask.json‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,16 @@
88
"path": "/1/indexes/theIndexName/task/123",
99
"method": "GET"
1010
}
11+
},
12+
{
13+
"testName": "getTask with taskID 0",
14+
"parameters": {
15+
"indexName": "theIndexName",
16+
"taskID": 0
17+
},
18+
"request": {
19+
"path": "/1/indexes/theIndexName/task/0",
20+
"method": "GET"
21+
}
1122
}
1223
]

0 commit comments

Comments
 (0)