Skip to content

Commit 969ccd4

Browse files
Merge pull request #147 from contentstack/fix/unit-testcases
fix: Fixed unit testcases
2 parents c8e3bbb + 54650f8 commit 969ccd4

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/lib/contentstack-core.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@ export function httpClient(options: HttpClientParams): AxiosInstance {
1414
httpsAgent: false,
1515
timeout: 30000,
1616
logHandler: (level: string, data?: any) => {
17-
if (level === 'error' && data) {
18-
const title = [data.name, data.message].filter((a) => a).join(' - ');
19-
console.error(`[error] ${title}`);
20-
17+
if (level === 'error') {
18+
if (data) {
19+
const title = [data.name, data.message].filter((a) => a).join(' - ');
20+
console.error(`[error] ${title}`);
21+
}
2122
return;
2223
}
23-
console.log(`[${level}] ${data}`);
24+
if (data !== undefined) {
25+
console.log(`[${level}] ${data}`);
26+
}
2427
},
2528
retryCondition: (error: any) => {
2629
if (error.response && error.response.status === 429) {

0 commit comments

Comments
 (0)