From 92b54aacc0de5446dd5497c39897b0bbff72e626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 13 Jun 2018 09:54:12 +0200 Subject: Rebuild using Asciideck --- .../cowboy/2.1/manual/cowboy_req.scheme/index.html | 93 +++++++--------------- 1 file changed, 28 insertions(+), 65 deletions(-) (limited to 'docs/en/cowboy/2.1/manual/cowboy_req.scheme') diff --git a/docs/en/cowboy/2.1/manual/cowboy_req.scheme/index.html b/docs/en/cowboy/2.1/manual/cowboy_req.scheme/index.html index a1937174..ca4c8f1a 100644 --- a/docs/en/cowboy/2.1/manual/cowboy_req.scheme/index.html +++ b/docs/en/cowboy/2.1/manual/cowboy_req.scheme/index.html @@ -62,89 +62,52 @@

cowboy_req:scheme(3)

-

Name

-
-

cowboy_req:scheme - URI scheme

-
-
-
+

cowboy_req:scheme - URI scheme

Description

-
-
-
-
scheme(Req :: cowboy_req:req()) -> Scheme :: binary()
-

Return the scheme of the effective request URI.

-

The scheme can also be obtained using pattern matching:

-
-
-
#{scheme := Scheme} = Req.
-
-
-
+
#{scheme := Scheme} = Req.
+

Arguments

-
-
-
-Req -
-
-

-The Req object. -

+
Req
+

The Req object.

-
-
- -
+

Return value

-
-

The scheme is returned as a binary. It is case insensitive.

-

Cowboy will only set the scheme to <<"http">> or <<"https">>.

-
-
-
+

The scheme is returned as a binary. It is case insensitive.

+

Cowboy will only set the scheme to <<"http">> or <<"https">>.

Changelog

-
-
    -
  • -

    -2.0: Function introduced. -

    +
    • 2.0: Function introduced.
    • -
-
-
-
+

Examples

-
-
-
Redirect HTTP to HTTPS
-
-
init(Req0=#{scheme := <<"http">>}, State) ->
-    Req = cowboy_req:reply(302, #{
-        <<"location">> => cowboy_req:uri(Req, #{scheme => <<"https">>})
-    }, Req0),
-    {ok, Req, State};
-init(Req, State) ->
-    {cowboy_rest, Req, State}.
-
-
-
+
init(Req0=#{scheme := <<"http">>}, State) ->
+    Req = cowboy_req:reply(302, #{
+        <<"location">> => cowboy_req:uri(Req, #{scheme => <<"https">>})
+    }, Req0),
+    {ok, Req, State};
+init(Req, State) ->
+    {cowboy_rest, Req, State}.
+

See also

-
- -
- +

cowboy_req(3)

+ -- cgit v1.2.3