mirror of
https://github.com/guzzle/guzzle.git
synced 2025-02-24 18:13:00 +01:00
added support for forms with method="get"
there's some forms with method unset or method="get", like http://en.wikipedia.org/wiki/Main_Page. Those pages were failing before this commit
This commit is contained in:
parent
d9f70ea3d8
commit
0e3bdd661a
@ -35,6 +35,8 @@ class EntityBody extends Stream
|
||||
return new static($stream);
|
||||
} elseif ($resource instanceof self) {
|
||||
return $resource;
|
||||
} elseif (is_array($resource)) {
|
||||
return self::factory(http_build_query($resource));
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException('Invalid resource type');
|
||||
|
@ -147,4 +147,13 @@ class EntityBodyTest extends \Guzzle\Tests\GuzzleTestCase
|
||||
$body = EntityBody::factory(fopen($this->getServer()->getUrl(), 'r'));
|
||||
$this->assertFalse($body->getContentMd5());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Guzzle\Http\EntityBody::factory
|
||||
*/
|
||||
public function testGetTypeFormBodyFactoring()
|
||||
{
|
||||
$body = EntityBody::factory(array('key1' => 'val1', 'key2' => 'val2'));
|
||||
$this->assertEquals('key1=val1&key2=val2', (string)$body);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user