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.3/manual/cowboy_middleware/index.html | 123 ++++++--------------- 1 file changed, 32 insertions(+), 91 deletions(-) (limited to 'docs/en/cowboy/2.3/manual/cowboy_middleware') diff --git a/docs/en/cowboy/2.3/manual/cowboy_middleware/index.html b/docs/en/cowboy/2.3/manual/cowboy_middleware/index.html index 200af7f6..7dc3e2bf 100644 --- a/docs/en/cowboy/2.3/manual/cowboy_middleware/index.html +++ b/docs/en/cowboy/2.3/manual/cowboy_middleware/index.html @@ -62,115 +62,56 @@

cowboy_middleware(3)

-

Name

-
-

cowboy_middleware - Middlewares

-
-
-
+

cowboy_middleware - Middlewares

Description

-
-

The module cowboy_middleware defines a callback interface for -Cowboy middlewares.

-

Middlewares process the request sequentially in the order they -are configured.

-
-
-
+

The module cowboy_middleware defines a callback interface for Cowboy middlewares.

+

Middlewares process the request sequentially in the order they are configured.

Callbacks

-
-

Middlewares implement the following interface:

-
-
-
execute(Req, Env)
-    -> {ok, Req, Env}
-     | {suspend, module(), atom(), [any()]}
-     | {stop, Req}
-
-Req :: cowboy_req:req()
-Env :: cowboy_middleware:env()
-

The execute/2 is the only callback that needs to be -implemented. It must execute the middleware and return -with instructions for Cowboy.

-
-
-ok -
-
-

-Cowboy should continue processing the request using the -returned Req object and environment. -

+
execute(Req, Env)
+    -> {ok, Req, Env}
+     | {suspend, module(), atom(), [any()]}
+     | {stop, Req}
+
+Req :: cowboy_req:req()
+Env :: cowboy_middleware:env()
+
+

The execute/2 is the only callback that needs to be implemented. It must execute the middleware and return with instructions for Cowboy.

+
ok
+

Cowboy should continue processing the request using the returned Req object and environment.

-
-suspend -
-
-

-Cowboy will hibernate the process. When resuming, Cowboy -will apply the returned module, function and arguments. -

+
suspend
+

Cowboy will hibernate the process. When resuming, Cowboy will apply the returned module, function and arguments.

-
-stop -
-
-

-Cowboy will stop middleware execution. No other middleware -will be executed. This effectively ends the processing of -the request. -

+
stop
+

Cowboy will stop middleware execution. No other middleware will be executed. This effectively ends the processing of the request.

-
- - -
+

Types

-
-

env()

-
-
-
env() :: #{atom() => any()}
-

Middleware environment.

-

A new environment is created for every request. The initial -environment contained the user configured environment values -(like dispatch for example) plus the listener value which -contains the name of the listener for this connection.

-

Middlewares may modify the environment as necessary.

-
-
-
-
+
env() :: #{atom() => any()}
+
+

Middleware environment.

+

A new environment is created for every request. The initial environment contained the user configured environment values (like dispatch for example) plus the listener value which contains the name of the listener for this connection.

+

Middlewares may modify the environment as necessary.

Changelog

-
-
    -
  • -

    -2.0: The env type is now a map instead of a proplist. -

    +
    • 2.0: The env type is now a map instead of a proplist.
    • -
    • -

      -1.0: Behavior introduced. -

      +
    • 1.0: Behavior introduced.
    • -
-
- -
+

See also

- -
+

cowboy(7)

+ -- cgit v1.2.3