Amp\ArtaxTest\ClientHttpBinIntegrationTest::testCustomUserAgentSentIfAssigned PHP Method

testCustomUserAgentSentIfAssigned() public method

    public function testCustomUserAgentSentIfAssigned()
    {
        $uri = 'http://httpbin.org/user-agent';
        $client = new Client();
        $customUserAgent = 'test-user-agent';
        $request = (new Request())->setUri($uri)->setHeader('User-Agent', $customUserAgent);
        $promise = $client->request($request);
        $response = \Amp\wait($promise);
        $this->assertInstanceOf('Amp\\Artax\\Response', $response);
        $body = $response->getBody();
        $result = json_decode($body);
        $this->assertSame($customUserAgent, $result->{'user-agent'});
    }