File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ Content-Type Plugin
2+ ===================
3+
4+ The ``ContentTypePlugin `` sets the correct ``Content-Type `` header value based on the content of the body stream of the
5+ request. This helps HTTP servers to handle the request::
6+
7+ use Http\Discovery\HttpClientDiscovery;
8+ use Http\Client\Common\PluginClient;
9+ use Http\Client\Common\Plugin\ContentTypePlugin;
10+
11+ $contentTypePlugin = new ContentTypePlugin();
12+
13+ $pluginClient = new PluginClient(
14+ HttpClientDiscovery::find(),
15+ [$contentTypePlugin]
16+ );
17+
18+ 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.
19+
20+ Options
21+ -------
22+
23+ ``skip_detection ``: boolean (default: false)
24+
25+ When set to ``true ``, content type detection will be performed only if the body request content size is under the
26+ size_limit parameter value.
27+
28+ ``size_limit ``: int (default: a little bit over 15Mb)
29+
30+ Determine the size stream limit for which the detection as to be skipped if ``skip_detection `` is ``true ``.
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ request or you can even start a completely new request. This gives you full cont
1313 authentication
1414 cache
1515 content-length
16+ content-type
1617 cookie
1718 decoder
1819 error
You can’t perform that action at this time.
0 commit comments