in src/WebJobs.Script/Binding/Http/RawScriptResult.cs [41:94]
public async Task ExecuteResultAsync(ActionContext context)
{
HttpResponse response = context.HttpContext.Response;
if (Headers != null)
{
foreach (var header in Headers)
{
if (header.Key.Equals("content-type", StringComparison.OrdinalIgnoreCase))
{
if (header.Value == null)
{
throw new InvalidOperationException("content-type header cannot be null");
}
response.ContentType = header.Value.ToString();
}
else
{
if (response.Headers.ContainsKey(header.Key))
{
Utility.AccumulateDuplicateHeader(response.HttpContext, header.Key);
}
else
{
response.Headers.Append(header.Key, header.Value.ToString() ?? string.Empty);
}
}
}
}
if (StatusCode != null)
{
response.StatusCode = StatusCode.Value;
}
if (Cookies != null)
{
foreach (var cookie in Cookies)
{
if (cookie.Item3 != null)
{
// CodeQL [SM02373] This code path constructs the cookie collection based on what the out-of-process function app (where customers can set these cookies) sends to the host. Overriding this behavior would introduce a breaking change for those customers.
response.Cookies.Append(cookie.Item1, cookie.Item2, cookie.Item3);
}
else
{
// CodeQL [SM02373] This code path constructs the cookie collection based on what the out-of-process function app (where customers can set these cookies) sends to the host. Overriding this behavior would introduce a breaking change for those customers.
response.Cookies.Append(cookie.Item1, cookie.Item2);
}
}
}
await WriteResponseBodyAsync(response, Content);
}