flush
[mdref/mdref-http] / http / Client / Request / getContentType.md
1 # string http\Client\Request::getContentType()
2
3 Extract the currently set "Content-Type" header.
4 See http\Client\Request::setContentType().
5
6 ## Params:
7
8 None.
9
10 ## Returns:
11
12 * string, the currently set content type.
13 * NULL, if no "Content-Type" header is set.
14
15 ## Example:
16
17 <?php
18 $multi = new http\Message\Body;
19 $multi->addPart(new http\Message("Content-type: text/plain\n\nHello part 1!"));
20 $multi->addPart(new http\Message("Content-type: text/plain\n\nHello part 2!"));
21 $request = new http\Client\Request("POST", "http://localhost/", [], $multi);
22 var_dump($request->getContentType());
23 ?>
24
25 Yields:
26
27 string(49) "multipart/form-data; boundary="30718774.3fcf95cc""