I have a class which extends angular Http
class, let's call it MyHttp
.
I also have MyJwtHttp
class which extends MyHttp
class.
I want to be able to return the response as json the problem is that if I'm doing something like this:
myJwtHttp.request(..).map(res=>res.json()
and the implementation of the request
method is:
class MyHttp extends Http {
request(url,...){
..
..
return super.request(url).subscribe(res=> doSomething(res))
}
}
The problem here is that the map
function is getting invoked before the subscriber of the MyHttp
class. This causes the input of the doSomething(res)
to be a json and not the response itself..
I have tried using last
instead of map
but it won't return the json to the caller of the request.
Any idea how to solve this issue?