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); }
/** * @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); }
public function testOPTIONS() { $request = $this->client->createRequest('OPTIONS', 'http://local.example'); $curl = $this->curlFormatter->format($request); $this->assertContains('-X OPTIONS', $curl); }