I have a problem with retrieve header value from my .get request.
In my API I have Max-range:65
- this values tell me how much items exist in DB. Because I get them by 10 I'is very important to know how much items exist on server. How Can I grab this information in my request? It's look a like:
In my service I has a method:
public getRequest(params, refresh?: boolean): Observable<any> {
const getUrl = '/coreapi/request';
return this.http
.get(getUrl, {params})
.map((result: Obj[]) => {
for (const item of result) {
const unit = new Test(
item.id,
item.value);
this.unitSet.push(unit);
}
return this.unitSet;
});
}
And in component I subscribe this like:
this.sub
.do(() => {
// do something
})
.distinctUntilChanged()
.switchMap((data: any) => {
return this.service.getRequest(data.httpParams, data.refresh);
})
.subscribe((result: Unit[]) => {
this.units = result;
});
---- EDIT
But I get only this headers from list of 12:
{"pragma" => "pragma"},
{"content-type" => "content-type"},
{"cache-control" => "cache-control"},
{"expires" => "expires"}
Do you know how to grab custom headers?