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);
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)) {
let responseText = '';
if (fetchResponse.body.byteLength) {
@ -665,7 +665,7 @@ export class GlobalAPIRequestContext extends APIRequestContext {
baseURL: options.baseURL,
userAgent: options.userAgent || getUserAgent(),
extraHTTPHeaders: options.extraHTTPHeaders,
apiRequest: {failOnStatusCode: !!options.apiRequest?.failOnStatusCode},
apiRequest: { failOnStatusCode: !!options.apiRequest?.failOnStatusCode },
ignoreHTTPSErrors: !!options.ignoreHTTPSErrors,
httpCredentials: options.httpCredentials,
clientCertificates: options.clientCertificates,

View file

@ -545,7 +545,7 @@ it('should throw when failOnStatusCode is set to true', async ({ playwright, ser
res.end('Not found.');
});
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 }) => {
@ -555,8 +555,8 @@ it('should throw when failOnStatusCode is set to true inside the fetch API call'
res.writeHead(404, { 'Content-Length': 10, 'Content-Type': 'text/plain' });
res.end('Not found.');
});
const error = await request.fetch(server.EMPTY_PAGE, {failOnStatusCode: true}).catch(e => e);
expect(error.message).toContain('404 Not Found')
const error = await request.fetch(server.EMPTY_PAGE, { failOnStatusCode: true }).catch(e => e);
expect(error.message).toContain('404 Not Found');
});
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.');
});
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 }) => {
@ -577,6 +577,6 @@ it('should not throw when failOnStatusCode is set to false inside the fetch API
res.writeHead(404, { 'Content-Length': 10, 'Content-Type': 'text/plain' });
res.end('Not found.');
});
const error = await request.fetch(server.EMPTY_PAGE, {failOnStatusCode: false}).catch(e => e);
expect(error.message).toBeUndefined()
const error = await request.fetch(server.EMPTY_PAGE, { failOnStatusCode: false }).catch(e => e);
expect(error.message).toBeUndefined();
});