File tree Expand file tree Collapse file tree 1 file changed +32
-3
lines changed
doc/reference/reference_lua Expand file tree Collapse file tree 1 file changed +32
-3
lines changed Original file line number Diff line number Diff line change @@ -12,18 +12,47 @@ The HTTP client uses the `libcurl <https://curl.haxx.se/libcurl/>`_ library unde
12
12
takes into account the `environment variables <https://curl.haxx.se/libcurl/c/libcurl-env.html >`_ libcurl understands.
13
13
14
14
15
+ .. _http_client_instance :
16
+
17
+ HTTP client instance
18
+ --------------------
19
+
20
+ .. _http_client_instance_default :
21
+
22
+ Default client
23
+ ~~~~~~~~~~~~~~
24
+
25
+ The ``http.client `` submodule provides the default HTTP client instance:
26
+
27
+ .. literalinclude :: /code_snippets/test/http_client/default_client_get_test.lua
28
+ :language: lua
29
+ :lines: 1
30
+
31
+ In this case, you need to make requests using the dot syntax, for example:
32
+
33
+ .. literalinclude :: /code_snippets/test/http_client/default_client_get_test.lua
34
+ :language: lua
35
+ :lines: 2
36
+
37
+
15
38
.. _creating_client :
16
39
17
40
Creating a client
18
- -----------------
41
+ ~~~~~~~~~~~~~~~~~
19
42
20
- To create an HTTP client, call the :ref: `http.client.new() <http-new >` function:
43
+ If you need to configure specific HTTP client options, use the :ref: `http.client.new() <http-new >` function to create the client instance :
21
44
22
45
.. literalinclude :: /code_snippets/test/http_client/get_test.lua
23
46
:language: lua
24
47
:lines: 1
25
48
26
- Optionally, this function can accept specific client configuration options.
49
+ In this case, you need to make requests using the colon syntax, for example:
50
+
51
+ .. literalinclude :: /code_snippets/test/http_client/get_test.lua
52
+ :language: lua
53
+ :lines: 2
54
+
55
+ All the examples in this section use the HTTP client created using ``http.client.new() ``.
27
56
28
57
29
58
.. _making_requests :
You can’t perform that action at this time.
0 commit comments