From 441272421acfae86d3605e1533e0f5f3b9c2b1c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 3 Oct 2018 09:58:55 +0200 Subject: Cowboy 2.5.0 --- .../cowboy/2.5/manual/cowboy_req.method/index.html | 196 +++++++++++++++++++++ 1 file changed, 196 insertions(+) create mode 100644 docs/en/cowboy/2.5/manual/cowboy_req.method/index.html (limited to 'docs/en/cowboy/2.5/manual/cowboy_req.method') diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.method/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.method/index.html new file mode 100644 index 00000000..ab70dd43 --- /dev/null +++ b/docs/en/cowboy/2.5/manual/cowboy_req.method/index.html @@ -0,0 +1,196 @@ + + + + + + + + + + Nine Nines: cowboy_req:method(3) + + + + + + + + + + + + + + + + +
+
+
+
+ +

cowboy_req:method(3)

+ +

Name

+

cowboy_req:method - HTTP method

+

Description

+
+
method(Req :: cowboy_req:req()) -> Method :: binary()
+
+

Return the request's HTTP method.

+

The method can also be obtained using pattern matching:

+
+
#{method := Method} = Req.
+
+

Arguments

+
Req
+

The Req object.

+
+
+

Return value

+

The request's HTTP method is returned as a binary string. While methods are case sensitive, standard methods are always uppercase.

+

Changelog

+
  • 2.0: Only the method is returned, it is no longer wrapped in a tuple. +
  • +
  • 1.0: Function introduced. +
  • +
+

Examples

+
Ensure the request's method is GET
+
+
<<"GET">> = cowboy_req:method(Req).
+
+
Allow methods from list
+
+
init(Req, State) ->
+    case lists:member(cowboy_req:method(Req), [<<"GET">>, <<"POST">>]) of
+        true -> handle(Req, State);
+        false -> method_not_allowed(Req, State)
+    end.
+
+

See also

+

cowboy_req(3)

+ + + + + + +
+ +
+ + +

+ Cowboy + 2.5 + Function Reference + +

+ + + +

Navigation

+ +

Version select

+ + +
+
+
+
+ + + + + + + + + -- cgit v1.2.3