Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
ngx-http-retry
Advanced tools
[![npm version](https://badge.fury.io/js/ngx-http-retry.svg)](https://badge.fury.io/js/ngx-http-retry)
A configurable Angular HTTP interceptor to retry GET request and respond to errors and flaky connections.
To install this library, run:
npm install ngx-http-retry --save
-or- yarn add ngx-http-retry
and then import and configure it in your Angular AppModule
:
import { NgxHttpRetryModule } from 'ngx-http-retry';
@NgModule({
imports: [
NgxHttpRetryModule.forRoot()
],
providers: [serverUnavailableRetryStrategyProvider],
bootstrap: [AppComponent]
})
export class AppModule { }
You provide a collection of injectable classes that implement HttpRequestRetryStrategy
interface
using the HTTP_REQUEST_RETRY_STRATEGIES
InjectionToken
. This is how you tell ngx-http-retry
which status codes to retry, how many times to retry, and when to stop retrying.
In addition to being thrown by the http request observable like normal, the last HttpErrorResponse
before ngx-http-retry
stops retrying a request is 1) passed to the retry strategy's onFailure
method and 2) emitted on the NgxHttpRetryService
's httpRetryFailures
observable.
import { HttpRequestRetryStrategy } from 'ngx-http-retry';
@Injectable()
export class ServerUnavailableRetryStrategy implements HttpRequestRetryStrategy {
readonly statuses = [503];
readonly maxCount = 10;
delayFn() {
return 100;
}
onFailure(error: HttpErrorResponse) {
console.log('When ngx-http-retry stops retrying a request, the final error is passed back to the retry strategy.', error.status, error.url);
}
}
export const serverUnavailableRetryStrategyProvider: Provider = {
provide: HTTP_REQUEST_RETRY_STRATEGIES,
useClass: ServerUnavailableRetryStrategy,
multi: true
};
import { NgxHttpRetryService } from 'ngx-http-retry';
export class MyComponent implements OnInit {
constructor(private readonly ngxHttpRetryService: NgxHttpRetryService) { }
ngOnInit() {
this.ngxHttpRetryService.httpRetryFailures.subscribe(error => {
console.log('You can also listen to errors from all retry strategies in one place.', error.status, error.url);
});
}
}
MIT © Kevin Phelps
FAQs
[![npm version](https://badge.fury.io/js/ngx-http-retry.svg)](https://badge.fury.io/js/ngx-http-retry)
The npm package ngx-http-retry receives a total of 2 weekly downloads. As such, ngx-http-retry popularity was classified as not popular.
We found that ngx-http-retry demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.