File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
test/RestSharp.Tests.Integrated Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 1+ using System . Net ;
12using RestSharp . Tests . Integrated . Server ;
23
34namespace RestSharp . Tests . Integrated ;
@@ -33,4 +34,19 @@ public async Task Should_post_json_with_PostJsonAsync() {
3334
3435 response . Message . Should ( ) . Be ( body . Data ) ;
3536 }
37+
38+ class Response {
39+ public string Message { get ; set ; }
40+ }
41+
42+ [ Fact ]
43+ public async Task Should_post_large_form_data ( ) {
44+ const int length = 1024 * 1024 ;
45+ var superLongString = new string ( '?' , length ) ;
46+ var request = new RestRequest ( "post/form" , Method . Post ) . AddParameter ( "big_string" , superLongString ) ;
47+ var response = await _client . ExecuteAsync < Response > ( request ) ;
48+
49+ response . StatusCode . Should ( ) . Be ( HttpStatusCode . OK ) ;
50+ response . Data ! . Message . Should ( ) . Be ( $ "Works! Length: { length } ") ;
51+ }
3652}
Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ public HttpServer(ITestOutputHelper output = null) {
5353
5454 // POST
5555 _app . MapPost ( "/post/json" , ( TestRequest request ) => new TestResponse { Message = request . Data } ) ;
56+ _app . MapPost ( "/post/form" , ( HttpContext context ) => new TestResponse { Message = $ "Works! Length: { context . Request . Form [ "big_string" ] . ToString ( ) . Length } " } ) ;
5657
5758 IResult HandleHeaders ( HttpContext ctx ) {
5859 var response = ctx . Request . Headers . Select ( x => new TestServerResponse ( x . Key , x . Value ) ) ;
You can’t perform that action at this time.
0 commit comments