public function testDeleteRequestWithBody() { $request = new HttpRequest(); $request->setMethod('DELETE'); $request->setUrl('http://httpbin.org/delete?foo=23&bar=42'); $request->setBody(array('foo' => 23, 'bar' => 42)); $request->on('responseReceived', function ($event) { $response = $event->getTarget(); if ($response->getHeaders()->get('Content-Type')->getMimeType() == 'application/json') { $decoded = json_decode($response->getBody()); $response->setBody($decoded); } }); $response = $request->send(); $headers = $response->getHeaders(); $this->assertEquals('HTTP/1.1 200 OK', $headers->get('Status')); $this->assertEquals('application/json', $headers->get('Content-Type')->getMimeType()); $body = $response->getBody(); $this->assertEquals(23, $body->args->foo); $this->assertEquals(42, $body->args->bar); $this->assertEquals(23, $body->form->foo); $this->assertEquals(42, $body->form->bar); }