Esempio n. 1
0
 public function testProperBodyReading()
 {
     $request = new Request('PUT', 'example.local', [], Stream::factory('foo=bar&hello=world'));
     $request->getBody()->getContents();
     $curl = $this->curlFormatter->format($request);
     $this->assertContains("-d 'foo=bar&hello=world'", $curl);
     $this->assertContains("-X PUT", $curl);
 }
Esempio n. 2
0
 /**
  * @dataProvider getHeadersAndBodyData
  */
 public function testExtractBodyArgument($headers, $body)
 {
     // clean input of null bytes
     $body = str_replace(chr(0), '', $body);
     $request = new Request('POST', 'http://example.local', $headers, \GuzzleHttp\Psr7\stream_for($body));
     $curl = $this->curlFormatter->format($request);
     $this->assertContains('foo=bar&hello=world', $curl);
 }
Esempio n. 3
0
 public function testOPTIONS()
 {
     $request = $this->client->createRequest('OPTIONS', 'http://local.example');
     $curl = $this->curlFormatter->format($request);
     $this->assertContains('-X OPTIONS', $curl);
 }