| 1 |
= cowboy_req:version(3) |
| 2 |
|
| 3 |
== Name |
| 4 |
|
| 5 |
cowboy_req:version - HTTP version |
| 6 |
|
| 7 |
== Description |
| 8 |
|
| 9 |
[source,erlang] |
| 10 |
---- |
| 11 |
version(Req :: cowboy_req:req()) -> Version :: cowboy:http_version() |
| 12 |
---- |
| 13 |
|
| 14 |
Return the HTTP version used for the request. |
| 15 |
|
| 16 |
The version can also be obtained using pattern matching: |
| 17 |
|
| 18 |
[source,erlang] |
| 19 |
---- |
| 20 |
#{version := Version} = Req. |
| 21 |
---- |
| 22 |
|
| 23 |
== Arguments |
| 24 |
|
| 25 |
Req:: |
| 26 |
|
| 27 |
The Req object. |
| 28 |
|
| 29 |
== Return value |
| 30 |
|
| 31 |
The HTTP version used for the request is returned as an |
| 32 |
atom. It is provided for informative purposes only. |
| 33 |
|
| 34 |
== Changelog |
| 35 |
|
| 36 |
* *2.0*: Only the version is returned, it is no longer wrapped in a tuple. |
| 37 |
* *1.0*: Function introduced. |
| 38 |
|
| 39 |
== Examples |
| 40 |
|
| 41 |
.Get the HTTP version |
| 42 |
[source,erlang] |
| 43 |
---- |
| 44 |
Version = cowboy_req:version(Req). |
| 45 |
---- |
| 46 |
|
| 47 |
== See also |
| 48 |
|
| 49 |
link:man:cowboy_req(3)[cowboy_req(3)] |