cowboy_req.host.asciidoc 911 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. = cowboy_req:host(3)
  2. == Name
  3. cowboy_req:host - URI host name
  4. == Description
  5. [source,erlang]
  6. ----
  7. host(Req :: cowboy_req:req()) -> Host :: binary()
  8. ----
  9. Return the host name of the effective request URI.
  10. The host name can also be obtained using pattern matching:
  11. [source,erlang]
  12. ----
  13. #{host := Host} = Req.
  14. ----
  15. == Arguments
  16. Req::
  17. The Req object.
  18. == Return value
  19. The host name is returned as a lowercase binary string.
  20. It is case insensitive.
  21. == Changelog
  22. * *2.0*: Only the host name is returned, it is no longer wrapped in a tuple.
  23. * *1.0*: Function introduced.
  24. == Examples
  25. .Get the effective request URI's host name
  26. [source,erlang]
  27. ----
  28. Host = cowboy_req:host(Req).
  29. ----
  30. == See also
  31. link:man:cowboy_req(3)[cowboy_req(3)],
  32. link:man:cowboy_req:binding(3)[cowboy_req:binding(3)],
  33. link:man:cowboy_req:bindings(3)[cowboy_req:bindings(3)],
  34. link:man:cowboy_req:host_info(3)[cowboy_req:host_info(3)]