Comparison

teal-src/net/http.d.tl @ 12609:a8eb838fc6cf

net.http: Add teal description files
author Kim Alvefur <zash@zash.se>
date Sun, 24 Jul 2022 21:25:03 +0200
child 12612:588b1d175838
comparison
equal deleted inserted replaced
12608:946a11f794e2 12609:a8eb838fc6cf
1 local record Promise
2 -- util.promise
3 end
4
5 local record sslctx -- from LuaSec
6 end
7
8 local record lib
9
10 enum http_method
11 "GET"
12 "HEAD"
13 "POST"
14 "PUT"
15 "OPTIONS"
16 "DELETE"
17 -- etc?
18 end
19
20 record http_client_options
21 sslctx : sslctx
22 end
23
24 record http_options
25 id : string
26 onlystatus : boolean
27 body : string
28 method : http_method
29 headers : { string : string }
30 insecure : boolean
31 suppress_errors : boolean
32 streaming_handler : function
33 suppress_url : boolean
34 sslctx : sslctx
35 end
36
37 record http_request
38 host : string
39 port : string
40 enum scheme
41 "http"
42 "https"
43 end
44 scheme : scheme
45 url : string
46 userinfo : string
47 path : string
48
49 method : http_method
50 headers : { string : string }
51
52 insecure : boolean
53 suppress_errors : boolean
54 streaming_handler : function
55 http : http_client
56 time : integer
57 id : string
58 callback : http_callback
59 end
60
61 record http_response
62 end
63
64 type http_callback = function (string, number, http_response, http_request)
65
66 record http_client
67 options : http_client_options
68 request : function (http_client, string, http_options, http_callback)
69 end
70
71 request : function (string, http_options, http_callback) : Promise, string
72 default : http_client
73 new : function (http_client_options) : http_client
74 events : table
75 -- COMPAT
76 urlencode : function (string) : string
77 urldecode : function (string) : string
78 formencode : function ({ string : string }) : string
79 formdecode : function (string) : { string : string }
80 destroy_request : function (http_request)
81
82 enum available_features
83 "sni"
84 end
85 features : { available_features : boolean }
86 end
87
88 return lib