@@ -564,7 +564,7 @@ public void multipart() {
564564 }).ready (client -> {
565565 client .post ("/large" , new MultipartBody .Builder ()
566566 .setType (MultipartBody .FORM )
567- .addFormDataPart ("f" , "19kb.txt" , create (MediaType .parse ("text/plain" ), _19kb ))
567+ .addFormDataPart ("f" , "19kb.txt" , create (_19kb , MediaType .parse ("text/plain" )))
568568 .build (), rsp -> {
569569 assertEquals (_19kb , rsp .body ().string ());
570570 });
@@ -573,8 +573,8 @@ public void multipart() {
573573 .setType (MultipartBody .FORM )
574574 .addFormDataPart ("user.name" , "user" )
575575 .addFormDataPart ("f" , "fileupload.js" ,
576- create (MediaType . parse ( "application/javascript" ),
577- userdir ( "src" , "test" , "resources" , "files" , "fileupload.js" ). toFile ( )))
576+ create (userdir ( "src" , "test" , "resources" , "files" , "fileupload.js" ). toFile ( ),
577+ MediaType . parse ( "application/javascript" )))
578578 .build (), rsp -> {
579579 assertEquals ("fileupload.js(type=application/javascript;exists=true)" ,
580580 rsp .body ().string ());
@@ -583,10 +583,8 @@ public void multipart() {
583583 client .post ("/files" , new MultipartBody .Builder ()
584584 .setType (MultipartBody .FORM )
585585 .addFormDataPart ("user.name" , "user" )
586- .addFormDataPart ("f" , "f1.txt" ,
587- create (MediaType .parse ("text/plain" ), "text1" ))
588- .addFormDataPart ("f" , "f2.txt" ,
589- create (MediaType .parse ("text/plain" ), "text2" ))
586+ .addFormDataPart ("f" , "f1.txt" , create ("text1" , MediaType .parse ("text/plain" )))
587+ .addFormDataPart ("f" , "f2.txt" , create ("text2" , MediaType .parse ("text/plain" )))
590588 .build (), rsp -> {
591589 assertEquals ("[f1.txt=5, f2.txt=5]" , rsp .body ().string ());
592590 });
@@ -595,9 +593,9 @@ public void multipart() {
595593 .setType (MultipartBody .FORM )
596594 .addFormDataPart ("user.name" , "user" )
597595 .addFormDataPart ("f" , "f1.txt" ,
598- create (MediaType .parse ("text/plain" ), "text1" ))
596+ create ("text1" , MediaType .parse ("text/plain" )))
599597 .addFormDataPart ("f" , "f2.txt" ,
600- create (MediaType .parse ("text/plain" ), "text2" ))
598+ create ("text2" , MediaType .parse ("text/plain" )))
601599 .build (), rsp -> {
602600 assertEquals ("{user.name=[user], f=[f1.txt, f2.txt]}" , rsp .body ().string ());
603601 });
@@ -606,8 +604,8 @@ public void multipart() {
606604 .setType (MultipartBody .FORM )
607605 .addFormDataPart ("name" , "foo_report" )
608606 .addFormDataPart ("filename" , "fileupload.js" ,
609- create (MediaType . parse ( "application/javascript" ),
610- userdir ( "src" , "test" , "resources" , "files" , "fileupload.js" ). toFile ( )))
607+ create (userdir ( "src" , "test" , "resources" , "files" , "fileupload.js" ). toFile ( ),
608+ MediaType . parse ( "application/javascript" )))
611609 .build (), rsp -> {
612610 assertEquals ("foo_report=true" , rsp .body ().string ());
613611 });
@@ -616,9 +614,9 @@ public void multipart() {
616614 .setType (MultipartBody .FORM )
617615 .addFormDataPart ("name" , "foo_report" )
618616 .addFormDataPart ("filename" , "f1.txt" ,
619- create (MediaType .parse ("text/plain" ), "text1" ))
617+ create ("text1" , MediaType .parse ("text/plain" )))
620618 .addFormDataPart ("filename" , "f2.txt" ,
621- create (MediaType .parse ("text/plain" ), "text2" ))
619+ create ("text2" , MediaType .parse ("text/plain" )))
622620 .build (), rsp -> {
623621 assertEquals ("foo_report=[f1.txt, f2.txt]" , rsp .body ().string ());
624622 });
@@ -703,16 +701,16 @@ public void parser() {
703701 app .post ("/str" , ctx -> ctx .body ().value ());
704702 }).ready ((client , server ) -> {
705703 client .header ("Content-Type" , "application/json" );
706- client .post ("/map" , create (json , "{\" foo\" : \" bar\" }" ), rsp -> {
704+ client .post ("/map" , create ("{\" foo\" : \" bar\" }" , json ), rsp -> {
707705 assertEquals ("{\" foo\" :\" bar\" }" , rsp .body ().string ());
708706 });
709707
710708 client .header ("Content-Type" , "application/json" );
711- client .post ("/ints" , create (json , "[3, 4, 1]" ), rsp -> {
709+ client .post ("/ints" , create ("[3, 4, 1]" , json ), rsp -> {
712710 assertEquals ("[3,4,1]" , rsp .body ().string ());
713711 });
714712
715- client .post ("/str" , create (textplain , _19kb ), rsp -> {
713+ client .post ("/str" , create (_19kb , textplain ), rsp -> {
716714 String value = rsp .body ().string ();
717715 assertEquals (_19kb , value ,
718716 server .getClass ().getSimpleName () + " expected: " + _19kb .length () + ", got: " + value
@@ -1236,21 +1234,21 @@ public void maxRequestSize() {
12361234 app .get ("/request-size" , ctx -> ctx .body ().value ());
12371235 }).ready ((client , server ) -> {
12381236 // Exceeds
1239- client .post ("/request-size" , RequestBody .create (MediaType .get ("text/plain" ), _19kb ), rsp -> {
1237+ client .post ("/request-size" , RequestBody .create (_19kb , MediaType .get ("text/plain" )), rsp -> {
12401238 assertEquals (413 , rsp .code (), server .getClass ().getSimpleName ());
12411239 });
12421240 // Chunk by chunk
1243- client .post ("/request-size" , RequestBody .create (MediaType .get ("text/plain" ), _16kb ), rsp -> {
1241+ client .post ("/request-size" , RequestBody .create (_16kb , MediaType .get ("text/plain" )), rsp -> {
12441242 assertEquals (200 , rsp .code ());
12451243 assertEquals (_16kb , rsp .body ().string (), server .getClass ().getSimpleName ());
12461244 });
12471245 // Single read
1248- client .post ("/request-size" , RequestBody .create (MediaType .get ("text/plain" ), _8kb ), rsp -> {
1246+ client .post ("/request-size" , RequestBody .create (_8kb , MediaType .get ("text/plain" )), rsp -> {
12491247 assertEquals (200 , rsp .code ());
12501248 assertEquals (_8kb , rsp .body ().string (), server .getClass ().getSimpleName ());
12511249 });
12521250 // Empty
1253- client .post ("/request-size" , RequestBody .create (MediaType .get ("text/plain" ), "" ), rsp -> {
1251+ client .post ("/request-size" , RequestBody .create ("" , MediaType .get ("text/plain" )), rsp -> {
12541252 assertEquals (200 , rsp .code ());
12551253 assertEquals ("" , rsp .body ().string (), server .getClass ().getSimpleName ());
12561254 });
0 commit comments