@@ -72,6 +72,7 @@ public async Task HttpTrigger_Get_Succeeds()
7272 HttpResponseMessage response = await this . _fixture . HttpClient . SendAsync ( request ) ;
7373 Assert . Equal ( HttpStatusCode . OK , response . StatusCode ) ;
7474 string body = await response . Content . ReadAsStringAsync ( ) ;
75+ Assert . Equal ( "text/plain" , response . Content . Headers . ContentType . MediaType ) ;
7576 Assert . Equal ( "Hello Mathew" , body ) ;
7677 }
7778
@@ -93,18 +94,36 @@ public async Task HttpTrigger_Disabled_SucceedsWithAdminKey()
9394 Assert . Equal ( "Hello World!" , body ) ;
9495 }
9596
97+ [ Fact ]
98+ public async Task GenericWebHook_CSharp_Post_Succeeds ( )
99+ {
100+ string uri = "api/webhook-generic-csharp?code=827bdzxhqy3xc62cxa2hmfsh6gxzhg30s5pi64tu" ;
101+ HttpRequestMessage request = new HttpRequestMessage ( HttpMethod . Post , uri ) ;
102+ request . Content = new StringContent ( "{ 'Value': 'Foobar' }" ) ;
103+ request . Content . Headers . ContentType = new MediaTypeHeaderValue ( "application/json" ) ;
104+
105+ HttpResponseMessage response = await this . _fixture . HttpClient . SendAsync ( request ) ;
106+ Assert . Equal ( HttpStatusCode . OK , response . StatusCode ) ;
107+ Assert . Equal ( "application/json" , response . Content . Headers . ContentType . MediaType ) ;
108+ string body = await response . Content . ReadAsStringAsync ( ) ;
109+ JObject jsonObject = JObject . Parse ( body ) ;
110+ Assert . Equal ( "Value: Foobar" , jsonObject [ "result" ] ) ;
111+ }
112+
96113 [ Fact ]
97114 public async Task GenericWebHook_Post_Succeeds ( )
98115 {
99116 string uri = "api/webhook-generic?code=1388a6b0d05eca2237f10e4a4641260b0a08f3a5" ;
100117 HttpRequestMessage request = new HttpRequestMessage ( HttpMethod . Post , uri ) ;
101- request . Content = new StringContent ( "{ 'a ': 'Foobar' }" ) ;
118+ request . Content = new StringContent ( "{ 'value ': 'Foobar' }" ) ;
102119 request . Content . Headers . ContentType = new MediaTypeHeaderValue ( "application/json" ) ;
103120
104121 HttpResponseMessage response = await this . _fixture . HttpClient . SendAsync ( request ) ;
105122 Assert . Equal ( HttpStatusCode . OK , response . StatusCode ) ;
123+ Assert . Equal ( "application/json" , response . Content . Headers . ContentType . MediaType ) ;
106124 string body = await response . Content . ReadAsStringAsync ( ) ;
107- Assert . Equal ( "WebHook processed successfully! Foobar" , body ) ;
125+ JObject jsonObject = JObject . Parse ( body ) ;
126+ Assert . Equal ( "Value: Foobar" , jsonObject [ "result" ] ) ;
108127 }
109128
110129 [ Fact ]
@@ -113,14 +132,17 @@ public async Task GenericWebHook_Post_AdminKey_Succeeds()
113132 // Verify that sending the admin key bypasses WebHook auth
114133 string uri = "api/webhook-generic?code=t8laajal0a1ajkgzoqlfv5gxr4ebhqozebw4qzdy" ;
115134 HttpRequestMessage request = new HttpRequestMessage ( HttpMethod . Post , uri ) ;
116- request . Content = new StringContent ( "{ 'a ': 'Foobar' }" ) ;
135+ request . Content = new StringContent ( "{ 'value ': 'Foobar' }" ) ;
117136 request . Content . Headers . ContentType = new MediaTypeHeaderValue ( "application/json" ) ;
118137
119138 HttpResponseMessage response = await this . _fixture . HttpClient . SendAsync ( request ) ;
120139 Assert . Equal ( HttpStatusCode . OK , response . StatusCode ) ;
140+ Assert . Equal ( "application/json" , response . Content . Headers . ContentType . MediaType ) ;
121141 string body = await response . Content . ReadAsStringAsync ( ) ;
122- Assert . Equal ( "WebHook processed successfully! Foobar" , body ) ;
142+ JObject jsonObject = JObject . Parse ( body ) ;
143+ Assert . Equal ( "Value: Foobar" , jsonObject [ "result" ] ) ;
123144 }
145+
124146 [ Fact ]
125147 public async Task QueueTriggerBatch_Succeeds ( )
126148 {
0 commit comments