cowboy_req.headers.asciidoc 860 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. = cowboy_req:headers(3)
  2. == Name
  3. cowboy_req:headers - HTTP headers
  4. == Description
  5. [source,erlang]
  6. ----
  7. headers(Req :: cowboy_req:req()) -> cowboy:http_headers()
  8. ----
  9. Return all request headers.
  10. Request headers can also be obtained using pattern matching:
  11. [source,erlang]
  12. ----
  13. #{headers := Headers} = Req.
  14. ----
  15. == Arguments
  16. Req::
  17. The Req object.
  18. == Return value
  19. Headers are returned as a map with keys being lowercase
  20. binary strings, and values as binary strings.
  21. == Changelog
  22. * *2.0*: Only the headers are returned, they are no longer wrapped in a tuple.
  23. * *1.0*: Function introduced.
  24. == Examples
  25. .Get all headers
  26. [source,erlang]
  27. ----
  28. Headers = cowboy_req:headers(Req).
  29. ----
  30. == See also
  31. link:man:cowboy_req(3)[cowboy_req(3)],
  32. link:man:cowboy_req:header(3)[cowboy_req:header(3)],
  33. link:man:cowboy_req:parse_header(3)[cowboy_req:parse_header(3)]