MCPcopy Create free account
hub / github.com/dim-an/cod / Request

Method Request

server/client.go:54–70  ·  view source on GitHub ↗
(req interface{}, rsp interface{})

Source from the content-addressed store, hash-verified

52}
53
54func (c *Client) Request(req interface{}, rsp interface{}) (err error) {
55 reqString := MarshalRequest(req)
56 reqString = append(reqString, byte('\n'))
57 _, err = c.conn.Write(reqString)
58 if err != nil {
59 return
60 }
61
62 data, err := c.reader.ReadBytes('\n')
63 if err != nil {
64 err = fmt.Errorf("cannot read server response: %w", err)
65 return
66 }
67 err, warns := UnmarshalResponseToVar(data, rsp)
68 util.LogWarnings(warns)
69 return
70}
71
72func (c *Client) Close() (err error) {
73 err = c.conn.Close()

Callers 10

learnMainFunction · 0.95
shellApiAttachMainFunction · 0.95
apiPollUpdatesMainFunction · 0.80
apiPostexecMainFunction · 0.80
apiListClientsMainFunction · 0.80
initMainFunction · 0.80
apiCompleteWordsMainFunction · 0.80
listMainFunction · 0.80
removeMainFunction · 0.80
updateMainFunction · 0.80

Calls 3

LogWarningsFunction · 0.92
MarshalRequestFunction · 0.85
UnmarshalResponseToVarFunction · 0.85

Tested by

no test coverage detected