-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
client.go
58 lines (45 loc) · 1.25 KB
/
client.go
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
package http_ns
import (
"github.com/inoxlang/inox/internal/core/symbolic"
"github.com/inoxlang/inox/internal/prettyprint"
pprint "github.com/inoxlang/inox/internal/prettyprint"
)
var (
HTTP_CLIENT_PROPNAMES = []string{"get_host_cookies"}
_ = []symbolic.ProtocolClient{(*Client)(nil)}
)
type Client struct {
symbolic.UnassignablePropsMixin
_ int
}
func (c *Client) Test(v symbolic.Value, state symbolic.RecTestCallState) bool {
state.StartCall()
defer state.FinishCall()
_, ok := v.(*Client)
return ok
}
func (c *Client) GetGoMethod(name string) (*symbolic.GoFunction, bool) {
switch name {
case "get_host_cookies":
return symbolic.WrapGoMethod(c.GetHostCookies), true
}
return nil, false
}
func (c *Client) Prop(name string) symbolic.Value {
return symbolic.GetGoMethodOrPanic(name, c)
}
func (*Client) PropertyNames() []string {
return HTTP_CLIENT_PROPNAMES
}
func (*Client) Schemes() []string {
return []string{"http", "https"}
}
func (c *Client) PrettyPrint(w prettyprint.PrettyPrintWriter, config *pprint.PrettyPrintConfig) {
w.WriteName("http-client")
}
func (c *Client) WidestOfType() symbolic.Value {
return &Client{}
}
func (c *Client) GetHostCookies(h *symbolic.Host) *symbolic.List {
return symbolic.NewListOf(NewCookieObject())
}