(cmd *cobra.Command, urlPath string, opts ...HTTPOption)
| 293 | } |
| 294 | |
| 295 | func 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 | } |
nothing calls this directly
no test coverage detected