Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-string header values on http response throws error #2768

Closed
ahmelsayed opened this issue Apr 30, 2018 · 4 comments
Closed

Non-string header values on http response throws error #2768

ahmelsayed opened this issue Apr 30, 2018 · 4 comments

Comments

@ahmelsayed
Copy link
Contributor

From @graham-sportsmgmt on February 17, 2018 3:49

azure-functions-core-tools@2.0.1-beta.22
JavaScript HttpTrigger
Local function emulator on Windows 10 x64

I am trying to set a response header in order to flag the length of the result set to our front end code.

This method throws an error:

context.res = {
  "headers" : { "length": response.length },
  "body": response
};

invocationResponse.outputData.data.http.headers: string{k:string} expected

This method doesn't throw an error, but adds no header to the response:

context.res.setHeader('length', response.length);

Copied from original issue: Azure/azure-functions-core-tools#386

@ahmelsayed
Copy link
Contributor Author

From @pilot4u on February 22, 2018 11:55

I'm struggling with this issue as well, has anyone managed to overcome this issue?

@pragnagopa
Copy link
Member

pragnagopa commented May 9, 2018

@mhoeger - here is the test that might be throwing the same error BadContentType_ThrowsExpectedException_Conneg

Right now headers in the proto file are key ,value pairs: RpcHttp Header. Please investigate if we need to move to
map<string,TypedData> headers = 3;

@mhoeger
Copy link
Contributor

mhoeger commented May 9, 2018

Thanks for finding the related test! I think you're right that we should be able to accept TypedData instead of just string, since V1 lets users do this.

The error is that we only accept string:string key value pairs on http headers right now.
The workaround is to cast the header value to a string.

@mhoeger mhoeger changed the title Can't set headers on response (2.0.1-beta.22) Non-string header values on http response throws error May 9, 2018
@pragnagopa
Copy link
Member

This issue was moved to Azure/azure-functions-language-worker-protobuf#9

@ghost ghost locked as resolved and limited conversation to collaborators Jan 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants