mdref.json config
[mdref/mdref-http] / http / Message / setHttpVersion.md
1 # http\Message http\Message::setHttpVersion(string $http_version)
2
3 Set the HTTP protocol version of the message.
4 See http\Message::getHttpVersion().
5
6 ## Params:
7
8 * string $http_version
9 The protocol version, e.g. "1.1", optionally prefixed by "HTTP/".
10
11 ## Returns:
12
13 * http\Message, self.
14
15 ## Notices:
16
17 * If a non-standard version separator is encounted.
18
19 ## Throws:
20
21 * http\Exception\InvalidArgumentException
22 * http\Exception\BadHeaderException
23
24 ## Example:
25
26 <?php
27 $message = new http\Message;
28 var_dump($message->getHttpVersion());
29 $message->setHttpVersion("HTTP/1_0");
30 var_dump($message->getHttpVersion());
31 ?>
32
33 Yields:
34
35 string(3) "1.1"
36 Notice: Non-standard version separator '_' in HTTP protocol version 'HTTP/1_0'
37 string(3) "1.0"