mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 17:33:47 +00:00
swarm/api: block api.Put with wait
This commit is contained in:
parent
21771c11d1
commit
4a0bf28985
2 changed files with 4 additions and 2 deletions
|
|
@ -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)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue