Sets the raw HTTP request body, this method is mainly used by test scripts to simulate raw HTTP requests.
public setRawBody ( string $rawBody ) | ||
$rawBody | string | the request body |
public function testNoCData() { $request = new Request(['parsers' => ['application/xml' => XmlParser::className()]]); $xml_body = '<xml><ToUserName>test</ToUserName></xml>'; $request->setRawBody($xml_body); $result = $request->post(); $this->assertArrayHasKey('ToUserName', $result); }