swarm/api: block api.Put with wait

This commit is contained in:
Anton Evangelatov 2018-02-09 16:14:42 +01:00
parent 21771c11d1
commit 4a0bf28985
2 changed files with 4 additions and 2 deletions

View file

@ -109,10 +109,11 @@ func TestApiPut(t *testing.T) {
content := "hello"
exp := expResponse(content, "text/plain", 0)
// exp := expResponse([]byte(content), "text/plain", 0)
key, _, err := api.Put(content, exp.MimeType)
key, wait, err := api.Put(content, exp.MimeType)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
wait()
resp := testGet(t, api, key.Hex(), "")
checkResponse(t, resp, exp)
})

View file

@ -42,10 +42,11 @@ func NewStorage(api *Api) *Storage {
//
// DEPRECATED: Use the HTTP API instead
func (self *Storage) Put(content, contentType string) (string, error) {
key, _, err := self.api.Put(content, contentType)
key, wait, err := self.api.Put(content, contentType)
if err != nil {
return "", err
}
wait()
return key.Hex(), err
}