
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
node-angular-http-client
Advanced tools
Just install the package in your project and if you use
injection-js
, import HTTP_CLIENT_PROVIDERS
and add
them to your injector's providers.
If you want to use the HttpClient
without using injection-js
in your own project, importing and running createHttpClient()
will create and resolve the HttpClient
for you, giving you an
instance of it to use directly. It takes an options object within
which the interceptors
key is an array of HttpInterceptor
s.
Note: HttpClient
taken from Angular 5.0.0-beta.5
,
and made to work independently of Angular.
injection-js
@Injectable()
class TestInterceptor implements HttpInterceptor {
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
console.warn('intercepted');
return next.handle(request);
}
}
@Injectable()
class GoogleTest {
constructor(private httpClient: HttpClient) {}
run() {
this.httpClient.get('http://www.google.com', {responseType: 'text'}).subscribe(
res => console.dir(res)
);
}
}
const injector = ReflectiveInjector.resolveAndCreate([
...HTTP_CLIENT_PROVIDERS,
{ provide: HTTP_INTERCEPTORS, useClass: TestInterceptor, multi: true },
GoogleTest
]);
const googleTest = injector.get(GoogleTest);
googleTest.run();
class TestInterceptor implements HttpInterceptor {
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
console.warn('intercepted');
return next.handle(request);
}
}
const httpClient: HttpClient = createHttpClient({interceptors: [TestInterceptor]});
httpClient.get('http://www.google.com', {responseType: 'text'}).subscribe(
res => console.dir(res)
);
FAQs
The Angular 4.3 HttpClient for node.js
The npm package node-angular-http-client receives a total of 11 weekly downloads. As such, node-angular-http-client popularity was classified as not popular.
We found that node-angular-http-client 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.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.