File tree Expand file tree Collapse file tree 2 files changed +6
-12
lines changed
Expand file tree Collapse file tree 2 files changed +6
-12
lines changed Original file line number Diff line number Diff line change 11import { EventEmitter } from 'events' ;
2- import { ClientFeaturesDelta , ClientFeaturesResponse , parseClientFeaturesDelta } from '../feature' ;
2+ import { parseClientFeaturesDelta } from '../feature' ;
33import { get } from '../request' ;
44import getUrl from '../url-utils' ;
55import { UnleashEvents } from '../events' ;
@@ -151,7 +151,7 @@ export class PollingFetcher extends EventEmitter implements FetcherInterface {
151151 } else if ( res . ok ) {
152152 nextFetch = this . countSuccess ( ) ;
153153 try {
154- const data = ( await res . json ( ) ) as ClientFeaturesResponse | ClientFeaturesDelta ;
154+ const data = await res . json ( ) ;
155155 if ( res . headers . get ( 'etag' ) !== null ) {
156156 this . etag = res . headers . get ( 'etag' ) as string ;
157157 } else {
@@ -168,9 +168,9 @@ export class PollingFetcher extends EventEmitter implements FetcherInterface {
168168 }
169169
170170 if ( this . options . mode . type === 'polling' && this . options . mode . format === 'delta' ) {
171- await this . options . onSaveDelta ( parseClientFeaturesDelta ( data as ClientFeaturesDelta ) ) ;
171+ await this . options . onSaveDelta ( parseClientFeaturesDelta ( data ) ) ;
172172 } else {
173- await this . options . onSave ( data as ClientFeaturesResponse , true ) ;
173+ await this . options . onSave ( data , true ) ;
174174 }
175175 } catch ( err ) {
176176 this . emit ( UnleashEvents . Error , err ) ;
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ test('should retry on error', (t) =>
1313 res . end ( ) ;
1414 } ) ;
1515
16- server . listen ( 0 , '127.0.0.1' , ( ) => {
16+ server . listen ( ( ) => {
1717 // @ts -expect-error
1818 const { port } = server . address ( ) ;
1919
@@ -33,14 +33,8 @@ test('should retry on error', (t) =>
3333 } ) ;
3434 } ) ;
3535 server . on ( 'error' , ( e ) => {
36- if ( ( e as NodeJS . ErrnoException ) . code === 'EPERM' ) {
37- t . pass ( ) ;
38- server . close ( ) ;
39- resolve ( ) ;
40- return ;
41- }
42- server . close ( ) ;
4336 console . error ( e ) ;
4437 t . fail ( e . message ) ;
38+ server . close ( ) ;
4539 } ) ;
4640 } ) ) ;
You can’t perform that action at this time.
0 commit comments