@@ -807,6 +807,21 @@ public function testApplyBody()
807807 $ this ->assertSame ('name=George ' , $ request ->curl_options [CURLOPT_POSTFIELDS ]);
808808 }
809809
810+ public function testBodyIsResstOnSecondRequest ()
811+ {
812+ $ request = $ this ->getRequest ([
813+ 'base_uri ' => 'http://www.foo.com/api/v1/ ' ,
814+ 'delay ' => 100 ,
815+ ]);
816+ $ request ->setBody ('name=George ' );
817+ $ request ->setOutput ('Hi there ' );
818+
819+ $ request ->post ('answer ' );
820+ $ request ->post ('answer ' );
821+
822+ $ this ->assertArrayNotHasKey (CURLOPT_POSTFIELDS , $ request ->curl_options );
823+ }
824+
810825 public function testResponseHeaders ()
811826 {
812827 $ request = $ this ->getRequest ([
@@ -922,7 +937,10 @@ public function testJSONData()
922937 $ this ->assertSame ('post ' , $ this ->request ->getMethod ());
923938
924939 $ expected = json_encode ($ params );
925- $ this ->assertSame ($ expected , $ this ->request ->getBody ());
940+ $ this ->assertSame (
941+ $ expected ,
942+ $ this ->request ->curl_options [CURLOPT_POSTFIELDS ]
943+ );
926944 }
927945
928946 public function testSetJSON ()
@@ -936,7 +954,12 @@ public function testSetJSON()
936954 ];
937955 $ this ->request ->setJSON ($ params )->post ('/post ' );
938956
939- $ this ->assertSame (json_encode ($ params ), $ this ->request ->getBody ());
957+ $ expected = json_encode ($ params );
958+ $ this ->assertSame (
959+ $ expected ,
960+ $ this ->request ->curl_options [CURLOPT_POSTFIELDS ]
961+ );
962+
940963 $ this ->assertSame (
941964 'Content-Type: application/json ' ,
942965 $ this ->request ->curl_options [CURLOPT_HTTPHEADER ][0 ]
0 commit comments