Example #1
0
 public function testResponse()
 {
     $request = new Request(['url' => 'http://httpbin.org/user-agent', 'options' => [CURLOPT_USERAGENT => 'Tester']]);
     $response = $request->execute()->getResponse();
     $content = json_decode($response->content, true);
     $this->assertTrue($request->isExecuted());
     $this->assertNull($request->getErrorMessage());
     $this->assertTrue($request->isSuccessful());
     $this->assertEquals('application/json', $response->getHeader('Content-Type'));
     $this->assertEquals(200, $response->getStatusCode());
     $this->assertEquals('Tester', $content['user-agent']);
 }