Example #1
0
 /**
  * @group issue-399
  * @link  https://github.com/guzzle/guzzle/issues/399
  */
 public function testDiscardingUnknownPropertiesWithAliasing()
 {
     $visitor = new Visitor();
     $param = new Parameter(array('location' => 'header', 'name' => 'ContentType', 'sentAs' => 'Content-Type', 'additionalParameters' => false));
     $visitor->visit($this->command, $this->response, $param, $this->value);
     $this->assertEquals('text/plain', $this->value['ContentType']);
     $this->assertArrayNotHasKey('X-Foo', $this->value);
 }
Example #2
0
 public function testVisitsMappedPrefixHeaders()
 {
     $visitor = new Visitor();
     $param = new Parameter(array('location' => 'header', 'name' => 'Metadata', 'sentAs' => 'X-Baz-', 'type' => 'object', 'additionalProperties' => array('type' => 'string')));
     $response = new Response(200, array('X-Baz-Test' => 'ABC', 'X-Baz-Bar' => array('123', '456'), 'Content-Length' => 3), 'Foo');
     $visitor->visit($this->command, $response, $param, $this->value);
     $this->assertEquals(array('Metadata' => array('Test' => 'ABC', 'Bar' => array('123', '456'))), $this->value);
 }