I have two WebApi (.NET Core) application e.g. WebApi1 and WebApi2. Now I am calling/consuming WebApi1 (endpoint) from WebApi2. How do I get WebApi1 Http Header values from WebApi2 application?
Tried with Request.Header; but did not get WebApi1 headers. Here is the code written in controller action -
(Request?.Headers ?? throw new Exception("Http Header is Null")).ToDictionary<KeyValuePair<string, StringValues>, string, string>(
header => header.Key, header => header.Value);
here I am getting WebApi2 header.
Request.Headers.GetValues(string name)?