Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions plugins/always-seekable-body-plugin.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Always Seekable Body Plugin
===========================

The ``AlwaysSeekableBodyPlugin`` ensure that body of the request and body of the response are always seekable.
This allows a lot of components that read the stream to rewind it in order to be used later by another component::

use Http\Discovery\HttpClientDiscovery;
use Http\Client\Common\PluginClient;
use Http\Client\Common\Plugin\AlwaysSeekableBodyPlugin;

$options = [
'use_file_buffer' => true,
'memory_buffer_size' => 2097152,
];
$alwaysSeekableBodyPlugin = new AlwaysSeekableBodyPlugin($options);

$pluginClient = new PluginClient(
HttpClientDiscovery::find(),
[$alwaysSeekableBodyPlugin]
);

The plugin supports the following options:

* ``use_file_buffer``: Whether it should use a temporary file to buffer the body of a stream if it's too big
* ``memory_buffer_size``: Maximum memory to use for buffering the stream before it switch to a file
2 changes: 2 additions & 0 deletions spelling_word_list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ phpdoc
Puli
rebase
Semver
Seekable
seekable
sexualized
sublicense
sync
Expand Down