Debian Codegraph @

doc/src/manual/cowboy_req.has_resp_header.asciidoc

raw
1 = cowboy_req:has_resp_header(3)
2
3 == Name
4
5 cowboy_req:has_resp_header - Is the given response header set?
6
7 == Description
8
9 [source,erlang]
10 ----
11 has_resp_header(Name, Req :: cowboy_req:req()) -> boolean()
12
13 Name :: binary() %% lowercase; case insensitive
14 ----
15
16 Return whether the given response header has been set.
17
18 The header name must be given as a lowercase binary string.
19 While header names are case insensitive, Cowboy requires them
20 to be given as lowercase to function properly.
21
22 == Arguments
23
24 Name::
25
26 Header name as a lowercase binary string.
27
28 Req::
29
30 The Req object.
31
32 == Return value
33
34 A boolean indicating whether the given response header has been set.
35
36 == Changelog
37
38 * *1.0*: Function introduced.
39
40 == Examples
41
42 .Check whether the content-type header has been set
43 [source,erlang]
44 ----
45 false = cowboy_req:has_resp_header(<<"content-type">>, Req0),
46 Req = cowboy_req:set_resp_header(<<"content-type">>, <<"text/html">>, Req0),
47 true = cowboy_req:has_resp_header(<<"content-type">>, Req).
48 ----
49
50 == See also
51
52 link:man:cowboy_req(3)[cowboy_req(3)],
53 link:man:cowboy_req:set_resp_header(3)[cowboy_req:set_resp_header(3)],
54 link:man:cowboy_req:set_resp_headers(3)[cowboy_req:set_resp_headers(3)],
55 link:man:cowboy_req:resp_header(3)[cowboy_req:resp_header(3)],
56 link:man:cowboy_req:resp_headers(3)[cowboy_req:resp_headers(3)],
57 link:man:cowboy_req:delete_resp_header(3)[cowboy_req:delete_resp_header(3)]