| 1 |
= cowboy_req:path(3) |
| 2 |
|
| 3 |
== Name |
| 4 |
|
| 5 |
cowboy_req:path - URI path |
| 6 |
|
| 7 |
== Description |
| 8 |
|
| 9 |
[source,erlang] |
| 10 |
---- |
| 11 |
path(Req :: cowboy_req:req()) -> Path :: binary() |
| 12 |
---- |
| 13 |
|
| 14 |
Return the path of the effective request URI. |
| 15 |
|
| 16 |
The path can also be obtained using pattern matching: |
| 17 |
|
| 18 |
[source,erlang] |
| 19 |
---- |
| 20 |
#{path := Path} = Req. |
| 21 |
---- |
| 22 |
|
| 23 |
== Arguments |
| 24 |
|
| 25 |
Req:: |
| 26 |
|
| 27 |
The Req object. |
| 28 |
|
| 29 |
== Return value |
| 30 |
|
| 31 |
The path is returned as a binary string. It is case sensitive. |
| 32 |
|
| 33 |
== Changelog |
| 34 |
|
| 35 |
* *2.0*: Only the path is returned, it is no longer wrapped in a tuple. |
| 36 |
* *1.0*: Function introduced. |
| 37 |
|
| 38 |
== Examples |
| 39 |
|
| 40 |
.Get the effective request URI's path |
| 41 |
[source,erlang] |
| 42 |
---- |
| 43 |
Path = cowboy_req:path(Req). |
| 44 |
---- |
| 45 |
|
| 46 |
== See also |
| 47 |
|
| 48 |
link:man:cowboy_req(3)[cowboy_req(3)], |
| 49 |
link:man:cowboy_req:binding(3)[cowboy_req:binding(3)], |
| 50 |
link:man:cowboy_req:bindings(3)[cowboy_req:bindings(3)], |
| 51 |
link:man:cowboy_req:path_info(3)[cowboy_req:path_info(3)] |