@@ -352,9 +352,9 @@ export class {{classname}} {
352352 if (typeof this.configuration.beforeHandler === 'function') {
353353 this.configuration.beforeHandler(' {{operationIdOriginal}}' , ' {{httpMethod}}' .toUpperCase());
354354 }
355- const afterHandler = (result: any, stopCancellation = true ) => {
355+ const afterHandler = (result: any) => {
356356 // stop cancellation to prevent calling afterHandler on next service call
357- if (stopCancellation && cancelPreviousRequest && this.cancelMap[' {{operationIdOriginal}}' ]) {
357+ if (cancelPreviousRequest && this.cancelMap[' {{operationIdOriginal}}' ]) {
358358 this.cancelMap[' {{operationIdOriginal}}' ].complete();
359359 delete this.cancelMap[' {{operationIdOriginal}}' ];
360360 }
@@ -364,7 +364,10 @@ export class {{classname}} {
364364 };
365365 handle = handle.pipe(tap(afterHandler, afterHandler));
366366 if (typeof this.configuration.afterHandler === 'function' && cancelPreviousRequest && this.cancelMap['{ {operationIdOriginal} }']) {
367- this.cancelMap[' {{operationIdOriginal}}' ].asObservable().pipe(take(1)).subscribe(() => afterHandler(new Error(' CANCELLED' ), false ));
367+ this.cancelMap[' {{operationIdOriginal}}' ]
368+ .asObservable()
369+ .pipe(take(1))
370+ .subscribe(() => this.configuration.afterHandler(' {{operationIdOriginal}}' , ' {{httpMethod}}' .toUpperCase(), new Error(' CANCELLED' )));
368371 }
369372
370373 if (typeof this.configuration.errorHandler === 'function') {
@@ -412,9 +415,9 @@ export class {{classname}} {
412415 if (typeof this.configuration.beforeHandler === 'function') {
413416 this.configuration.beforeHandler(' {{operationIdOriginal}}' , ' {{httpMethod}}' .toUpperCase());
414417 }
415- const afterHandler = (result: any, stopCancellation = true ) => {
418+ const afterHandler = (result: any) => {
416419 // stop cancellation to prevent calling afterHandler on next service call
417- if (stopCancellation && cancelPreviousRequest && this.cancelMap[' {{operationIdOriginal}}' ]) {
420+ if (cancelPreviousRequest && this.cancelMap[' {{operationIdOriginal}}' ]) {
418421 this.cancelMap[' {{operationIdOriginal}}' ].complete();
419422 delete this.cancelMap[' {{operationIdOriginal}}' ];
420423 }
@@ -424,7 +427,10 @@ export class {{classname}} {
424427 };
425428 handle = handle.tap(afterHandler, afterHandler);
426429 if (typeof this.configuration.afterHandler === 'function' && cancelPreviousRequest && this.cancelMap['{ {operationIdOriginal} }']) {
427- this.cancelMap[' {{operationIdOriginal}}' ].asObservable().take(1).subscribe(() => afterHandler(new Error(' CANCELLED' ), false ));
430+ this.cancelMap[' {{operationIdOriginal}}' ]
431+ .asObservable()
432+ .take(1)
433+ .subscribe(() => this.configuration.afterHandler(' {{operationIdOriginal}}' , ' {{httpMethod}}' .toUpperCase(), new Error(' CANCELLED' )));
428434 }
429435
430436 if (typeof this.configuration.errorHandler === 'function') {
0 commit comments