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 ;
1
2
using RestSharp . Tests . Integrated . Server ;
2
3
3
4
namespace RestSharp . Tests . Integrated ;
@@ -33,4 +34,19 @@ public async Task Should_post_json_with_PostJsonAsync() {
33
34
34
35
response . Message . Should ( ) . Be ( body . Data ) ;
35
36
}
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
+ }
36
52
}
Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ public HttpServer(ITestOutputHelper output = null) {
53
53
54
54
// POST
55
55
_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 } " } ) ;
56
57
57
58
IResult HandleHeaders ( HttpContext ctx ) {
58
59
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