Created
June 28, 2017 08:55
-
-
Save brancz/1c252d4c87a48c80df7c6b046823c466 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"net/http" | |
"net/url" | |
"os" | |
) | |
func main() { | |
query := os.Args[1] | |
fmt.Println("Query:", query) | |
resp, err := http.Get("http://localhost:9090/api/v1/query?query=" + url.QueryEscape(query)) | |
if err != nil { | |
panic(err) | |
} | |
defer resp.Body.Close() | |
body, err := ioutil.ReadAll(resp.Body) | |
if err != nil { | |
panic(err) | |
} | |
fmt.Println(string(body)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment