func main() { // jsonParsed,_ := gabs.ParseJSON([]byte(` // {"auth":{"passwordCredentials":{"username": "******", "password": "******"},"tenantName": "demo"}} // `)) // var value string // value,_ = jsonParsed.Path("auth.passwordCredentials.username").Data().(string) // fmt.Println(value) ends, err := cloudrequests.GetEndpointsFromFile("endpoints.json") if err != nil { panic(err) } // endchan := make(chan []cloudrequests.Endpoint) for i := 0; i < 1; i++ { // go func (){ ends = append(ends, ends...) // endchan <- ends // }() // concurrenttest(<-endchan) // bunktest(<-endchan) } // concurrenttest(ends) // bunktest(ends) fmt.Println("size: ", len(ends)) mJson := []byte(`{"auth":{"passwordCredentials":{"username": "******", "password": "******"},"tenantName": "demo"}}`) contentReader := bytes.NewReader(mJson) req, _ := http.NewRequest("POST", "http://172.16.90.2:5000/v2.0/tokens", contentReader) req.Header.Set("Content-Type", "application/json") // req.Header.Set("Notes","GoRequest is coming!") client := &http.Client{ Timeout: 1000 * time.Millisecond, } resp, err := client.Do(req) if err == nil { body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } var ep cloudrequests.Endpoint ep.Url = "http://172.16.90.2:5000/v2.0/tokens" ep.Method = "post" ep.Data = `{"auth":{"passwordCredentials":{"username": "******", "password": "******"},"tenantName": "demo"}}` request(ep) }
func test_end(ep cloudrequests.Endpoint, c chan string) { _, reason := ep.EndpointCheck() c <- reason }