Skip to content

Minor fixes to headers documentation #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 1, 2016
Merged
Changes from all 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
22 changes: 11 additions & 11 deletions plugins/headers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,32 @@ Header plugins are useful to manage request headers. Many operations are possibl
Default headers values
----------------------

The plugin ``HeaderDefaultPlugin`` allows to set default values for given headers.
The plugin ``HeaderDefaultsPlugin`` allows you to set default values for given headers.
That means if a header is not set, it will be added.
However, if the header already is present, the request is left unchanged.
However, if the header is already present, the request is left unchanged.

.. code:: php

use Http\Discovery\HttpClientDiscovery;
use Http\Client\Common\PluginClient;
use Http\Client\Common\Plugin\HeaderDefaultPlugin;
use Http\Client\Common\Plugin\HeaderDefaultsPlugin;

$defaultUserAgent = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1';

$headerDefaultPlugin = new HeaderDefaultPlugin([
$headerDefaultsPlugin = new HeaderDefaultsPlugin([
'User-Agent' => $defaultUserAgent
]);

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

Mandatory headers values
------------------------

The plugin ``HeaderSetPlugin`` allows to fix values of given header. That means that any request passing through
this plugin will have the given value for given header.
The plugin ``HeaderSetPlugin`` allows you to fix values of given headers. That means that any request passing through
this plugin will have the given value for the given header.

.. code:: php

Expand All @@ -56,7 +56,7 @@ this plugin will have the given value for given header.
Removing headers
----------------

The plugin ``HeaderRemovePlugin`` allows to remove given headers from the request.
The plugin ``HeaderRemovePlugin`` allows you to remove given headers from the request.

.. code:: php

Expand All @@ -79,7 +79,7 @@ The plugin ``HeaderRemovePlugin`` allows to remove given headers from the reques
Appending header values
-----------------------

The plugin ``HeaderAppendPlugin`` allows to set headers or to add values to existing headers.
The plugin ``HeaderAppendPlugin`` allows you to set headers or to add values to existing headers.
That means if the request already has the given headers then the value will be appended to the current value
but if the request does not already have the given header, it will be added to the request with the given value.

Expand Down Expand Up @@ -108,10 +108,10 @@ but if the request does not already have the given header, it will be added to t
Mixing operations
-----------------

Different header plugins can be mixed to achieve different behaviors
Different header plugins can be mixed together to achieve different behaviors
and you can use the same plugin for identical operations.

The following example will force the ``User-Agent`` and the ``Accept`` header values while removing ``Cookie`` header:
The following example will force the ``User-Agent`` and the ``Accept`` header values while removing the ``Cookie`` header:

.. code:: php

Expand Down