-
Notifications
You must be signed in to change notification settings - Fork 469
Add content headers to script headers object #1344
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -382,6 +382,8 @@ public async Task HttpTrigger_Get(string functionName) | |
request.Headers.Add("test-header", "Test Request Header"); | ||
string userAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36"; | ||
request.Headers.Add("user-agent", userAgent); | ||
string accept = "text/html, application/xhtml+xml, application/xml; q=0.9, */*; q=0.8"; | ||
request.Headers.Add("accept", accept); | ||
string customHeader = "foo,bar,baz"; | ||
request.Headers.Add("custom-1", customHeader); | ||
|
||
|
@@ -412,6 +414,7 @@ public async Task HttpTrigger_Get(string functionName) | |
JObject reqHeaders = (JObject)resultObject["reqHeaders"]; | ||
Assert.Equal("Test Request Header", reqHeaders["test-header"]); | ||
Assert.Equal(userAgent, reqHeaders["user-agent"]); | ||
Assert.Equal(accept, reqHeaders["accept"]); | ||
Assert.Equal(customHeader, reqHeaders["custom-1"]); | ||
} | ||
|
||
|
@@ -736,6 +739,7 @@ public async Task HttpTrigger_Post_PlainText() | |
Content = new StringContent(testData) | ||
}; | ||
request.SetConfiguration(new HttpConfiguration()); | ||
request.Content.Headers.ContentType = new MediaTypeHeaderValue("text/plain"); | ||
|
||
|
||
Dictionary<string, object> arguments = new Dictionary<string, object> | ||
{ | ||
|
@@ -752,6 +756,7 @@ public async Task HttpTrigger_Post_PlainText() | |
Assert.Equal(testData, (string)resultObject["reqBody"]); | ||
Assert.Equal("string", (string)resultObject["reqRawBodyType"]); | ||
Assert.Equal(testData, (string)resultObject["reqRawBody"]); | ||
Assert.Equal("text/plain", resultObject["reqHeaders"]["content-type"]); | ||
|
||
} | ||
|
||
[Fact] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have logic here https://github.com/Azure/azure-webjobs-sdk-script/blob/658d4d0c9dce9af940bd1a4fd8d5fb0f2fb85e90/src/WebJobs.Script/Binding/HttpBinding.cs#L290 that goes the other way - takes top level headers and applies them to a response. So what you're doing makes this symmetric for request content.