From 9c86e03384551a84bce346f29852b578e504caef Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Mon, 24 Sep 2018 12:27:57 +0200 Subject: [PATCH] endpoint Remote: fix broken Send endpoint for DryRun=true --- endpoint/endpoint.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/endpoint/endpoint.go b/endpoint/endpoint.go index 863e960..a92d41a 100644 --- a/endpoint/endpoint.go +++ b/endpoint/endpoint.go @@ -401,9 +401,13 @@ func (s Remote) Send(ctx context.Context, r *pdu.SendReq) (*pdu.SendRes, io.Read if err != nil { return nil, nil, err } - if rs == nil { + if !r.DryRun && rs == nil { return nil, nil, errors.New("response does not contain a stream") } + if r.DryRun && rs != nil { + rs.Close() + return nil, nil, errors.New("response contains unexpected stream (was dry run)") + } var res pdu.SendRes if err := proto.Unmarshal(rb.Bytes(), &res); err != nil { rs.Close()