From 27d57c55254f4242ca24e6ceb4e2d895a54b3ce0 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Wed, 11 Jul 2018 13:41:54 +0200 Subject: [PATCH] Add options to block put Block put is pretty much useless without these options so, IMO, breaking this isn't an issue. --- shell.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/shell.go b/shell.go index f9f6a4381..91b46cfec 100644 --- a/shell.go +++ b/shell.go @@ -670,7 +670,7 @@ func (s *Shell) BlockGet(path string) ([]byte, error) { return ioutil.ReadAll(resp.Output) } -func (s *Shell) BlockPut(block []byte) (string, error) { +func (s *Shell) BlockPut(block []byte, format, mhtype string, mhlen int) (string, error) { data := bytes.NewReader(block) rc := ioutil.NopCloser(data) fr := files.NewReaderFile("", "", rc, nil) @@ -679,6 +679,11 @@ func (s *Shell) BlockPut(block []byte) (string, error) { req := s.newRequest(context.Background(), "block/put") req.Body = fileReader + req.Opts = map[string]string{ + "mhtype": mhtype, + "mhlen": fmt.Sprintf("%d", mhlen), + "format": format, + } resp, err := req.Send(s.httpcli) if err != nil { return "", err