@@ -396,6 +396,44 @@ public async Task HttpTrigger_WithRawResponse_ReturnsContent(string expectedCont
396
396
Assert . Equal ( body . ToString ( ) , responseBody ) ;
397
397
}
398
398
399
+ [ Fact ]
400
+ public async Task HttpTrigger_GetPlainText_WithLongResponse_ReturnsExpectedResult ( )
401
+ {
402
+ HttpRequestMessage request = new HttpRequestMessage
403
+ {
404
+ RequestUri = new Uri ( string . Format ( "http://localhost/api/httptrigger-scenarios" ) ) ,
405
+ Method = HttpMethod . Get ,
406
+ } ;
407
+ request . SetConfiguration ( Fixture . RequestConfiguration ) ;
408
+ request . Headers . Accept . Add ( new MediaTypeWithQualityHeaderValue ( "text/plain" ) ) ;
409
+
410
+ JObject value = new JObject ( )
411
+ {
412
+ { "status" , "200" } ,
413
+ { "body" , new string ( '.' , 2000 ) }
414
+ } ;
415
+ JObject input = new JObject ( )
416
+ {
417
+ { "scenario" , "echo" } ,
418
+ { "value" , value }
419
+ } ;
420
+ request . Content = new StringContent ( input . ToString ( ) ) ;
421
+ request . Content . Headers . ContentType = new MediaTypeHeaderValue ( "application/json" ) ;
422
+
423
+ Dictionary < string , object > arguments = new Dictionary < string , object >
424
+ {
425
+ { "req" , request }
426
+ } ;
427
+ await Fixture . Host . CallAsync ( "HttpTrigger-scenarios" , arguments ) ;
428
+
429
+ HttpResponseMessage response = ( HttpResponseMessage ) request . Properties [ ScriptConstants . AzureFunctionsHttpResponseKey ] ;
430
+ Assert . Equal ( HttpStatusCode . OK , response . StatusCode ) ;
431
+ Assert . Equal ( "text/plain" , response . Content . Headers . ContentType . MediaType ) ;
432
+
433
+ string body = await response . Content . ReadAsStringAsync ( ) ;
434
+ Assert . Equal ( 2000 , body . Length ) ;
435
+ }
436
+
399
437
[ Theory ]
400
438
[ InlineData ( "application/json" , "\" testinput\" " ) ]
401
439
[ InlineData ( "application/xml" , "<string xmlns=\" http://schemas.microsoft.com/2003/10/Serialization/\" >testinput</string>" ) ]
0 commit comments