Azure / Azure/Azure-Functions

Content length header is missing in response for azure function v1

Open
#1,456 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
PowerShell
Stars
1.1k
Forks
215
Avg merge
4h 2m
Merged PRs (30d)
1

Description

We have azure function which is running with azure v1 (.NET Framework 4.7). In response we are trying to set the content length but it is not flowing to client. It sets the Transfer encoding header with value as chunked.

To give glimpse of how we are setting it.

` var body = `
`var resp = new HttpResponseMessage();`
` resp.Content = new ByteArrayContent(body);`
` response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");`
`response.Content.Headers.ContentLength = body.Length;`

I went through some [online discussion](https://social.msdn.microsoft.com/Forums/azure/en-US/7ceb818f-5e8c-42ff-b2ec-c0aa3f9094a2/app-service-suddenlt-started-to-respond-with-chunked-encoding-where-it-used-to-response-with?forum=windowsazurewebsitespreview) and https://github.com/Azure/azure-functions-host/issues/3765
There they talked about setting up,

`response.Headers["Content-Encoding"] = "identity";`
`response.Headers["Transfer-Encoding"] = "identity";`

But it seems to be of no use.
Would anyone faced such kind of issue before?
BTW, when I ran the same code on azure function v2 (.NET Core 2.2) it works.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.