// test write func TestWrite(t *testing.T) { reader := bytes.NewBuffer([]byte("testdata")) if err := backends.Write("testfile", reader); err != nil { t.Error("Failed to WRITE file - ", err) } }
// create writes data corresponding to specified key and returns a success message func create(rw http.ResponseWriter, req *http.Request) { key := req.URL.Query().Get(":blob") // if err := backends.Write(key, req.Body); err != nil { rw.Write([]byte(fmt.Sprintf("%s\n", err.Error()))) return } // rw.Write([]byte(fmt.Sprintf("'%s' created!\n", key))) }