Skip to content

Instantly share code, notes, and snippets.

@esell
Created March 31, 2017 19:07
Show Gist options
  • Save esell/b003c11e5ca5d9852f3f70a499003391 to your computer and use it in GitHub Desktop.
Save esell/b003c11e5ca5d9852f3f70a499003391 to your computer and use it in GitHub Desktop.
req, _ = http.NewRequest("POST", "", body)
req.Header.Add("Content-Type", writer.FormDataContentType())
w = httptest.NewRecorder()
router.ServeHTTP(w, req)
if w.Code != http.StatusOK {
t.Errorf("uploadHandler POST returned %v, should be %v", w.Code, http.StatusOK)
}
err = deleteTestImage(sampleImgPath)
if err != nil {
fmt.Println("unable to delete test image")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment