Is it possible to retrieve url inside processRequest? [...] If not why?
In the general sense, in f(g(x))
, f
cannot access x
, as it can only see what g
returns, and that return value doesn't have to have knowledge over x
at all. Consider g = u => 42
as a simple example of a function that doesn't retain the information about its input.
It would work if the return value retains that information. For example, for g = u => u
(the identity function), f
would of course know x
because that's exactly what gets passed to it. This requires f
to have this specific knowledge, though.
Since HttpClient#get
returns Observable
, this isn't the case here, though. This can be understood intuitively if you think about the fact that url
is information specific to the logic of HttpClient
, while Observable
stems from RxJs which doesn't know anything about Angular. More directly, it can be seen by simply inspecting Obervable
's type.
Is it possible to change url inside processRequest? [...] If not why?
This is now obvious, but you can't change what you can't access.