Slim - 将原始数据字符串传递给请求正文

I'm performing a unit test for my API endpoints in Slim. This is what I used to pass data to the endpoint:

$requestData = [
    'field1' => 123,
    'field2' => 4567,
    ....
]    
$request->withParsedBody($requestData);

Now need to test the endpoint with XML or JSON string like below -

    $requestData = '<xml>
           <appid><![CDATA[app123]]></appid>
           <device_info><![CDATA[test-device-5678]]></device_info>
           ....
           </xml>';
    $request->withParsedBody($requestData);

The problem is that withParsedBody() only accepts array or object. So my question is: what's the proper way to pass raw data string to the request?

This is the answer based on Dusan's comments.

        $request->getBody()->write($requestData);
        $request->reparseBody();

The reparseBody() call will force the request object to parse the new content again.