public function testWildcharEncoder()
 {
     $acceptHeader = new AcceptEncoding();
     $acceptHeader->addEncoding('compress', 0.8)->addEncoding('*', 0.4);
     $this->assertTrue($acceptHeader->hasEncoding('compress'));
     $this->assertTrue($acceptHeader->hasEncoding('gzip'));
     $this->assertEquals('Accept-Encoding: compress;q=0.8,*;q=0.4', $acceptHeader->toString());
 }
    public function testClientUsesAcceptEncodingHeaderFromRequestObject()
    {
        $client = new Client();

        $client->setAdapter('Zend\Http\Client\Adapter\Test');

        $request = $client->getRequest();

        $acceptEncodingHeader = new AcceptEncoding();
        $acceptEncodingHeader->addEncoding('foo', 1);
        $request->getHeaders()->addHeader($acceptEncodingHeader);

        $client->send();

        $rawRequest = $client->getLastRawRequest();

        $this->assertNotContains('Accept-Encoding: gzip, deflate', $rawRequest, null, true);
        $this->assertNotContains('Accept-Encoding: identity', $rawRequest, null, true);

        $this->assertContains('Accept-Encoding: foo', $rawRequest);
    }