-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add content-type plugin documentation (#204)
* Add content-type plugin documentation * Clean content-type plugin doc * Add ContentTypePlugin options * Indicate a more accurate default value
- Loading branch information
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
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. | ||
|
||
Options | ||
------- | ||
|
||
``skip_detection``: boolean (default: false) | ||
|
||
When set to ``true``, content type detection will be performed only if the body request content size is under the | ||
size_limit parameter value. | ||
|
||
``size_limit``: int (default: a little bit over 15Mb) | ||
|
||
Determine the size stream limit for which the detection as to be skipped if ``skip_detection`` is ``true``. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters