File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -331,6 +331,21 @@ export default class HttpClient {
331
331
return this . sendRequest ( 'HEAD' ) ;
332
332
}
333
333
334
+ /**
335
+ * Determine if response is successful.
336
+ *
337
+ * @param {Response } response
338
+ *
339
+ * @returns {boolean }
340
+ */
341
+ private isSuccessfulResponse ( response ?: Response ) : boolean {
342
+ if ( response === undefined ) {
343
+ return false ;
344
+ }
345
+
346
+ return response . ok ;
347
+ }
348
+
334
349
/**
335
350
* Process a OPTIONS request to the given URL.
336
351
*
@@ -490,7 +505,7 @@ export default class HttpClient {
490
505
491
506
try {
492
507
const response : Response = await this . attemptRequest ( method ) ;
493
- const successfulResponse : boolean = response !== undefined && response . ok ;
508
+ const successfulResponse : boolean = this . isSuccessfulResponse ( response ) ;
494
509
const shouldRetry = this . retryCallback ? this . retryCallback ( response , this ) : true ;
495
510
496
511
if ( ! successfulResponse && shouldRetry === true && this . requestAttempts <= this . retries ) {
You can’t perform that action at this time.
0 commit comments