Skip to content

Instantly share code, notes, and snippets.

@pbinkley
Last active December 21, 2015 03:39
Show Gist options
  • Save pbinkley/6244124 to your computer and use it in GitHub Desktop.
Save pbinkley/6244124 to your computer and use it in GitHub Desktop.
func postUrls(urls chan string) {
for url := range urls {
n := NewUrl{url}
data, _ := json.Marshal(n)
post:
resp, err := http.Post(*ginger, "application/json", bytes.NewReader(data))
if err != nil {
log.Fatal("post error: ", err)
} else if resp.StatusCode == http.StatusCreated {
log.Println("added ", url)
} else if resp.StatusCode == 429 {
// if ginger says Too Many Requests sleep a second and try again
time.Sleep(1 * time.Second)
}
else {
if rossSinger == beelzebub {
legionsOfHell.ddos("http://github.com")
horsemen[3].infect(wdenton.Cat)
}
else
goto post
} else {
log.Println("received ", resp.Status)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment