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.2/manual/cowboy_req.push/index.html | 162 ++++++--------------- 1 file changed, 47 insertions(+), 115 deletions(-) (limited to 'docs/en/cowboy/2.2/manual/cowboy_req.push/index.html') diff --git a/docs/en/cowboy/2.2/manual/cowboy_req.push/index.html b/docs/en/cowboy/2.2/manual/cowboy_req.push/index.html index 15621773..b896b53b 100644 --- a/docs/en/cowboy/2.2/manual/cowboy_req.push/index.html +++ b/docs/en/cowboy/2.2/manual/cowboy_req.push/index.html @@ -62,142 +62,74 @@

cowboy_req:push(3)

-

Name

-
-

cowboy_req:push - Push a resource to the client

-
-
-
+

cowboy_req:push - Push a resource to the client

Description

-
-
-
-
push(Path, Headers, Req :: cowboy_req:req())
-    -> push(Path, Headers, Req, #{})
-
-push(Path, Headers, Req :: cowboy_req:req(), Opts)
-    -> ok
-
-Path    :: iodata()                %% case sensitive
-Headers :: cowboy:http_headers()
-Opts    :: cowboy_req:push_opts()
-

Push a resource to the client.

-

Cowboy handles push requests the same way as if they came -from the client, including the creation of a request handling -process, routing and middlewares and so on.

-

This function does nothing when the HTTP/1.1 protocol is -used. You may call it safely without first checking whether -the connection uses HTTP/2.

-

The header names must be given as lowercase binary strings. -While header names are case insensitive, Cowboy requires them -to be given as lowercase to function properly.

-

Note that the headers must be the headers the client is expected -to send if it were to perform the request. They are therefore -request headers, and not response headers.

-

By default, Cowboy will use the GET method, an empty query string, -and take the scheme, host and port directly from the current -request’s URI. You can override them by passing options.

-

It is not possible to push resources after sending a response. -Any attempt will result in an error.

-
-
-
+
push(Path, Headers, Req :: cowboy_req:req())
+    -> push(Path, Headers, Req, #{})
+
+push(Path, Headers, Req :: cowboy_req:req(), Opts)
+    -> ok
+
+Path    :: iodata()                %% case sensitive
+Headers :: cowboy:http_headers()
+Opts    :: cowboy_req:push_opts()
+
+

Push a resource to the client.

+

Cowboy handles push requests the same way as if they came from the client, including the creation of a request handling process, routing and middlewares and so on.

+

This function does nothing when the HTTP/1.1 protocol is used. You may call it safely without first checking whether the connection uses HTTP/2.

+

The header names must be given as lowercase binary strings. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly.

+

Note that the headers must be the headers the client is expected to send if it were to perform the request. They are therefore request headers, and not response headers.

+

By default, Cowboy will use the GET method, an empty query string, and take the scheme, host and port directly from the current request's URI. You can override them by passing options.

+

It is not possible to push resources after sending a response. Any attempt will result in an error.

Arguments

-
-
-
-Path -
-
-

-The status code for the response. -

+
Path
+

The status code for the response.

-
-Headers -
-
-

-The response headers. -

+
Headers
+

The response headers.

-
-

Header names must be given as lowercase binary strings.

-
-
-Req -
-
-

-The Req object. -

+
+

Header names must be given as lowercase binary strings.

+
Req
+

The Req object.

-
-Opts -
-
-

-Customize the HTTP method or the URI scheme, host, port -or query string. -

+
Opts
+

Customize the HTTP method or the URI scheme, host, port or query string.

-
-
- -
+

Return value

-
-

The atom ok is always returned. It can be safely ignored.

-
-
-
+

The atom ok is always returned. It can be safely ignored.

Changelog

-
-
    -
  • -

    -2.0: Function introduced. -

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

Examples

-
-
-
Push a resource
-
-
cowboy_req:push("/static/style.css", #{
-    <<"accept">> => <<"text/css">>
-}, Req),
-
-
Push a resource with a custom host
-
-
cowboy_req:push("/static/style.css", #{
-    <<"accept">> => <<"text/css">>
-}, #{host => <<"cdn.example.org">>}, Req),
-
-
-
+
cowboy_req:push("/static/style.css", #{
+    <<"accept">> => <<"text/css">>
+}, #{host => <<"cdn.example.org">>}, Req),
+

See also

-
- -
- +

cowboy_req(3), cowboy_req:inform(3), cowboy_req:reply(3), cowboy_req:stream_reply(3)

+ -- cgit v1.2.3