Debian Codegraph @

doc/src/manual/cowboy_req.body_length.asciidoc

raw
1 = cowboy_req:body_length(3)
2
3 == Name
4
5 cowboy_req:body_length - Body length
6
7 == Description
8
9 [source,erlang]
10 ----
11 body_length(Req :: cowboy_req:req()) -> undefined | non_neg_integer()
12 ----
13
14 Return the length of the request body.
15
16 The length is not always known before reading the body.
17 In those cases Cowboy will return `undefined`. The body
18 length is available after the body has been fully read.
19
20 == Arguments
21
22 Req::
23
24 The Req object.
25
26 == Return value
27
28 The length of the request body, or `undefined` if it is
29 not known.
30
31 == Changelog
32
33 * *2.0*: Only the length is returned, it is no longer wrapped in a tuple.
34 * *1.0*: Function introduced.
35
36 == Examples
37
38 .Get the body length
39 [source,erlang]
40 ----
41 Length = cowboy_req:body_length(Req).
42 ----
43
44 == See also
45
46 link:man:cowboy_req(3)[cowboy_req(3)],
47 link:man:cowboy_req:has_body(3)[cowboy_req:has_body(3)],
48 link:man:cowboy_req:read_body(3)[cowboy_req:read_body(3)],
49 link:man:cowboy_req:read_urlencoded_body(3)[cowboy_req:read_urlencoded_body(3)],
50 link:man:cowboy_req:read_part(3)[cowboy_req:read_part(3)],
51 link:man:cowboy_req:read_part_body(3)[cowboy_req:read_part_body(3)]