--- breadcrumb: - What's new? - Version 3.5 summary-order: 7;95 keywords: - release - new features - "3.5" --- # What's new in 3.5 Version 3.5 only contains fixes. Streams now read as PSR-7 specifies, route paths match their literal text exactly, and the HTTP client sends request bodies it previously dropped. Some of these fixes change a behavior your project may rely on. To upgrade, follow [Upgrading from version 3.4 to 3.5](../getting-started/upgrading.md#upgrading-from-version-34-to-35). ## Streams read from the cursor `getContents()` now returns what remains after the cursor, instead of the whole stream. To read the whole body of a seekable stream, cast it to a string: ```php $stream = (new \Berlioz\Http\Message\HttpFactory())->createStream('abcdef'); $stream->read(2); // 'ab' $stream->getContents(); // 'cdef' (string) $stream; // 'abcdef' ``` A stream created from a string now starts at position zero: an immediate `write()` replaces its first bytes. See [Reading a stream](../components/http-message.md#reading-a-stream). ## Exact route paths The literal text of a route path now matches exactly: `/sitemap.xml` no longer matches `/sitemap-xml`, and `/catalogue/C++` matches the URL it generates. Regular expressions are only interpreted inside placeholders: ```php $route = new \Berlioz\Router\Route('/sitemap.xml'); $route = new \Berlioz\Router\Route('/files/{type:css|js}/app'); ``` See [Route attributes](../components/router.md#attributes). ## Non-seekable request bodies The HTTP client now sends a request whose body cannot be rewound, such as a socket or a pipe. It copies the body first, so the `Content-Length` header matches and the body is sent again on a retry: ```php use Berlioz\Http\Client\Client; use Berlioz\Http\Message\Request; use Berlioz\Http\Message\Stream; $body = new Stream(fopen('php://stdin', 'r')); $request = new Request('POST', 'https://example.com/upload', $body); $response = (new Client())->sendRequest($request); ``` See [Non-seekable request bodies](../components/http-client.md#non-seekable-request-bodies). ## Other changes - **HTTP client:** A `201 Created` response is returned as received, without following its `Location` header. See [Redirect security](../components/http-client.md#redirect-security). - **HTTP client:** `getCode()` returns the cURL error number when the cURL adapter reports the failure. See [Error code](../components/http-client.md#error-code). - **Queues:** The metadata of each deleted Redis job now expires on its own, `deletedJobsTtl` seconds after the deletion. See [RedisQueue](../components/queue-manager.md#redisqueue).