Created
August 9, 2014 17:30
-
-
Save michaeljs1990/98e900db67f96428b4d3 to your computer and use it in GitHub Desktop.
contentbody declared and not used.
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
// 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