@Martin Kallukalam Thanks for reaching out. Yes, the context.Request.Headers
context.Response.Headers
variable provides access to all the request/response headers.
You can indeed iterate over the context.Request.Headers
dictionary to list all the request headers and their values.
<set-variable name="allHeaders" value="@(string.Join(", ", context.Request.Headers.Select(h => h.Key + ": " + h.Value.FirstOrDefault())))" />
This policy sets a variable allHeaders
that contains a string with all the headers and their values, separated by commas. The FirstOrDefault()
method ensures that you get the actual value of each header.
do let me know incase of further queries, I would be happy to assist you.