ServerDataSource with HttpClien inteceptor
See original GitHub issueI’m using HttpClient and i have Interceptor to insert headers as token etc. How can i work with ServerDataSource and HttpClient through my interceptor? I tried base test (without interceptor) as
constructor(
http: HttpClient,
) {
this.source = new ServerDataSource( http, { endPoint: 'https://site.here/black_listed_client?_page=1&_limit=50&_order=DESC&_sort=id' } );
}
It shows an error:
Argument of type ‘HttpClient’ is not assignable to parameter of type ‘Http’. Property ‘_backend’ is missing in type ‘HttpClient’.
Also when im set _page=1&_limit=100 its ignored and im my request it looks like
?_order=DESC&_sort=id&_page=1&_limit=100&_page=1&_limit=10 It automatically added last 2 params as page=1 and limit=10
Now about work with interceptor. all my requests looks like Service
public getInfo(url:string): Observable<any>{
return this.http.get(url);
}
request
this.scoringService.getInfo('/scoring/stoplists/black_listed_client').subscribe(value => {
// value - результат
this.source = JSON.parse(value);
},
interceptor
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
const url = '/';
req = req.clone({
url: url + req.url,
responseType: 'text',
headers: req.headers.set('Authorization', this.sessionStorage.retrieve('access_token'))
});
........
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:8
Top Results From Across the Web
HttpClient Request intercepter like, at time of getting response ...
Something like this: @Injectable() export class I1 implements HttpInterceptor { constructor(public service: SomeService) ...
Read more >Insider's guide into interceptors and HttpClient mechanics in ...
Here I'll dig deeper into internal mechanics of the HttpClient service and ... For each interceptor we declare a class that implements intercept...
Read more >Pattern-Oriented Software Architecture, Patterns for ... - X-Files
The Interceptor architectural pattern (109) allows services to be added to a framework transparently and to be triggered automatically when certain events ...
Read more >Kuali Rice 2.2.0-M1 Release Notes - Directory listing for /
inject a serverDataSource into the CoreConfigurer which would point to your Kuali ... [KULRICE-5340] - Determine why CXF Interceptor to enforce immutable ...
Read more >Intro to Angular Http Interceptors - Ultimate Courses
Interceptors allow us to “intercept” incoming (or outgoing) HTTP requests using the HttpClient . By intercepting an HTTP request, we can modify ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It works with the Http (angular/http) library and not HttpClient (so far).
declare interceptor in your module as well:
This should also be added in your module where you are using smart table.