Can the url be manipulated within processRequest? [...] If not, what is the reason?
In a general context, in the scenario of f(g(x))
, f
does not have access to x
directly, as it can only operate on the output provided by g
. The return value from g
may not necessarily contain any information about the input x
. Consider g = u => 42
as an example where the function does not preserve details about its input.
However, if the return value includes the input information, such as in the case of g = u => u
(the identity function), then f
would have knowledge of x
since it receives this exact value. Yet, this requires f
to possess specific awareness of the input.
Given that HttpClient#get
produces an Observable
as its result, the situation differs here. To grasp this concept intuitively, consider that the url
pertains to the mechanics of HttpClient
, while Observable
originates from RxJs and does not pertain to Angular specifically. This distinction becomes apparent when examining the type of Observable
.
Is it feasible to alter the url within processRequest? [...] If not, why is this restriction in place?
It may seem obvious now, but modifying something necessitates the ability to access it first.