MCPcopy Create free account
hub / github.com/deepflowio/deepflow / GetURLInfo

Function GetURLInfo

cli/ctl/common/http_util.go:295–320  ·  view source on GitHub ↗
(cmd *cobra.Command, urlPath string, opts ...HTTPOption)

Source from the content-addressed store, hash-verified

293}
294
295func GetURLInfo(cmd *cobra.Command, urlPath string, opts ...HTTPOption) {
296
297 server := GetServerInfo(cmd)
298 url := fmt.Sprintf("http://%s:%d", server.IP, server.Port) + urlPath
299
300 response, err := CURLPerform("GET", url, nil, "", opts...)
301 if err != nil {
302 fmt.Fprintln(os.Stderr, err)
303 return
304 }
305
306 responseByte, err := response.MarshalJSON()
307 if err != nil {
308 fmt.Fprintln(os.Stderr, err)
309 return
310 }
311
312 var str bytes.Buffer
313 err = json.Indent(&str, responseByte, "", " ")
314 if err != nil {
315 fmt.Fprintln(os.Stderr, err)
316 return
317 }
318
319 fmt.Println(str.String())
320}

Callers

nothing calls this directly

Calls 4

GetServerInfoFunction · 0.85
CURLPerformFunction · 0.70
StringMethod · 0.65
MarshalJSONMethod · 0.45

Tested by

no test coverage detected