Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
contentbody declared and not used.
// Run all tests and log to file
func RunTests(tests []testCase) {
color.Blue("Starting test casses...")
client := &http.Client{}
for _, test := range tests {
color.Blue("Test: " + test.Name)
color.Blue(test.Method + " " + test.Path)
if data, err := test.Sent.MarshalJSON(); err == nil {
var contentbody io.Reader = nil
if string(data) != "null" {
contentbody := bytes.NewReader(data)
}
if req, err := http.NewRequest(test.Method, test.Path, contentbody); err == nil {
if resp, err := client.Do(req); err == nil {
if returned, err := ioutil.ReadAll(resp.Body); err == nil {
fmt.Println(string(returned))
} else {
color.Red(err.Error())
}
} else {
color.Red(err.Error())
}
} else {
color.Red(err.Error())
}
} else {
color.Red(err.Error())
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.