-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprax.lua
80 lines (61 loc) · 1.51 KB
/
prax.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
--- @meta _
--- @return nil
--- only focus the proxy on request that match a target ref
function focus() end
--- @param name string
--- @return TargetRef
--- target a host for proxy rules
function target(name) end
--- @class TargetRef
TargetRef = {}
--- @param ... Rule | RedirectRule Rules to add to target reference
--- @return TargetRef
--- add request rules to the current target
function TargetRef:req(...) end
--- @param ... Rule
--- @return TargetRef
--- add response rules to the current target
function TargetRef:resp(...) end
--- @class Attr
--- An attribute of a response or request
--- @class Rule
--- A rule that can be applied during the processing
--- of a request or repsonse
--- @class RedirectRule
--- A rule to redirect a request
--- @param name string
--- @return Attr
--- Identifies a header in a request or response
function header(name) end
--- @param name string
--- @return Attr
--- Identifies a query in a request
function query(name) end
--- @param attr Attr
--- @param value string
--- @return Rule
--- set a value for a given Attr
function set(attr, value) end
--- @param attr Attr
--- @param transform string | fun(string): string
--- @return Rule
---
--- substitute a value for a given Attr
function sub(attr, transform) end
--- @param host string
--- @return Rule
---
--- redirect requests to a new host
function redirect(host) end
--- @type Rule
dump = nil
--- @type Rule
intercept = nil
--- @type Attr
method = nil
--- @type Attr
status = nil
--- @type Attr
path = nil
--- @type Attr
body = nil