public function testSerializesRequestWithBody()
{
$body = json_encode(['test' => 'value']);
$stream = new Stream('php://memory', 'wb+');
$stream->write($body);
$request = (new Request())->withMethod('POST')->withUri(new Uri('http://example.com/foo/bar'))->withAddedHeader('Accept', 'application/json')->withAddedHeader('Content-Type', 'application/json')->withBody($stream);
$message = Serializer::toString($request);
$this->assertContains("POST /foo/bar HTTP/1.1\r\n", $message);
$this->assertContains("\r\n\r\n" . $body, $message);
}