fix: fixing eslint errors

This commit is contained in:
JacksonLei123 2025-01-15 17:33:29 -05:00
parent e3965545a4
commit 3dd6e863e1
2 changed files with 8 additions and 8 deletions

View file

@ -208,7 +208,7 @@ export abstract class APIRequestContext extends SdkObject {
}); });
const fetchUid = this._storeResponseBody(fetchResponse.body); const fetchUid = this._storeResponseBody(fetchResponse.body);
this.fetchLog.set(fetchUid, controller.metadata.log); this.fetchLog.set(fetchUid, controller.metadata.log);
let failOnStatusCode = params.failOnStatusCode !== undefined ? params.failOnStatusCode : !!defaults.apiRequest?.failOnStatusCode; const failOnStatusCode = params.failOnStatusCode !== undefined ? params.failOnStatusCode : !!defaults.apiRequest?.failOnStatusCode;
if (failOnStatusCode && (fetchResponse.status < 200 || fetchResponse.status >= 400)) { if (failOnStatusCode && (fetchResponse.status < 200 || fetchResponse.status >= 400)) {
let responseText = ''; let responseText = '';
if (fetchResponse.body.byteLength) { if (fetchResponse.body.byteLength) {

View file

@ -545,7 +545,7 @@ it('should throw when failOnStatusCode is set to true', async ({ playwright, ser
res.end('Not found.'); res.end('Not found.');
}); });
const error = await request.fetch(server.EMPTY_PAGE).catch(e => e); const error = await request.fetch(server.EMPTY_PAGE).catch(e => e);
expect(error.message).toContain('404 Not Found') expect(error.message).toContain('404 Not Found');
}); });
it('should throw when failOnStatusCode is set to true inside the fetch API call', async ({ playwright, server }) => { it('should throw when failOnStatusCode is set to true inside the fetch API call', async ({ playwright, server }) => {
@ -556,7 +556,7 @@ it('should throw when failOnStatusCode is set to true inside the fetch API call'
res.end('Not found.'); res.end('Not found.');
}); });
const error = await request.fetch(server.EMPTY_PAGE, { failOnStatusCode: true }).catch(e => e); const error = await request.fetch(server.EMPTY_PAGE, { failOnStatusCode: true }).catch(e => e);
expect(error.message).toContain('404 Not Found') expect(error.message).toContain('404 Not Found');
}); });
it('should not throw when failOnStatusCode is set to false', async ({ playwright, server }) => { it('should not throw when failOnStatusCode is set to false', async ({ playwright, server }) => {
@ -567,7 +567,7 @@ it('should not throw when failOnStatusCode is set to false', async ({ playwright
res.end('Not found.'); res.end('Not found.');
}); });
const error = await request.fetch(server.EMPTY_PAGE).catch(e => e); const error = await request.fetch(server.EMPTY_PAGE).catch(e => e);
expect(error.message).toBeUndefined() expect(error.message).toBeUndefined();
}); });
it('should not throw when failOnStatusCode is set to false inside the fetch API call', async ({ playwright, server }) => { it('should not throw when failOnStatusCode is set to false inside the fetch API call', async ({ playwright, server }) => {
@ -578,5 +578,5 @@ it('should not throw when failOnStatusCode is set to false inside the fetch API
res.end('Not found.'); res.end('Not found.');
}); });
const error = await request.fetch(server.EMPTY_PAGE, { failOnStatusCode: false }).catch(e => e); const error = await request.fetch(server.EMPTY_PAGE, { failOnStatusCode: false }).catch(e => e);
expect(error.message).toBeUndefined() expect(error.message).toBeUndefined();
}); });