MCPcopy
hub / github.com/uber/aresdb / buildRequest

Method buildRequest

controller/client/controller.go:70–88  ·  view source on GitHub ↗

buildRequest builds an http.Request with headers.

(method, path string, body io.Reader)

Source from the content-addressed store, hash-verified

68
69// buildRequest builds an http.Request with headers.
70func (c *ControllerHTTPClient) buildRequest(method, path string, body io.Reader) (req *http.Request, err error) {
71 path = strings.TrimPrefix(path, "/")
72 url := fmt.Sprintf("http://%s/%s", c.address, path)
73 req, err = http.NewRequest(method, url, body)
74 if err != nil {
75 req = nil
76 return
77 }
78
79 headersCopy := http.Header{}
80 for k, vs := range c.headers {
81 for _, v := range vs {
82 headersCopy.Add(k, v)
83 }
84 }
85 headersCopy.Add("RPC-Procedure", path)
86 req.Header = headersCopy
87 return
88}
89
90func (c *ControllerHTTPClient) getResponse(request *http.Request) (respBytes []byte, err error) {
91 resp, err := c.c.Do(request)

Callers 9

GetSchemaHashMethod · 0.95
GetAllSchemaMethod · 0.95
GetNamespacesMethod · 0.95
GetAssignmentHashMethod · 0.95
GetAssignmentMethod · 0.95
FetchSchemaMethod · 0.95
FetchAllEnumsMethod · 0.95
ExtendEnumCasesMethod · 0.95
controller_test.goFile · 0.80

Calls 1

AddMethod · 0.65

Tested by

no test coverage detected