Skip to content

Add content-type plugin documentation #204

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 4 commits into from
Aug 10, 2017
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
18 changes: 18 additions & 0 deletions plugins/content-type.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Content-Type Plugin
===================

The ``ContentTypePlugin`` sets the correct ``Content-Type`` header value based on the content of the body stream of the
request. This helps HTTP servers to handle the request::

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

$contentTypePlugin = new ContentTypePlugin();

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

For now, the plugin can only detect JSON or XML content. If the content of the stream can not be determined, the plugin does nothing.
1 change: 1 addition & 0 deletions plugins/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ request or you can even start a completely new request. This gives you full cont
authentication
cache
content-length
content-type
cookie
decoder
error
Expand Down