MCPcopy Index your code
hub / github.com/foxcpp/maddy / Body

Method Body

internal/testutils/target.go:146–174  ·  view source on GitHub ↗
(ctx context.Context, header textproto.Header, buf buffer.Buffer)

Source from the content-addressed store, hash-verified

144}
145
146func (dtd *testTargetDelivery) Body(ctx context.Context, header textproto.Header, buf buffer.Buffer) error {
147 if dtd.tgt.PartialBodyErr != nil {
148 return errors.New("partial failure occurred, no additional information available")
149 }
150 if dtd.tgt.BodyErr != nil {
151 return dtd.tgt.BodyErr
152 }
153
154 dtd.msg.Header = header
155
156 body, err := buf.Open()
157 if err != nil {
158 return err
159 }
160 defer func() {
161 if err := body.Close(); err != nil {
162 panic(err)
163 }
164 }()
165
166 if dtd.tgt.DiscardMessages {
167 // Don't bother.
168 _, err = io.Copy(io.Discard, body)
169 return err
170 }
171
172 dtd.msg.Body, err = io.ReadAll(body)
173 return err
174}
175
176func (dtd *testTargetDelivery) Abort(ctx context.Context) error {
177 return dtd.tgt.AbortErr

Callers

nothing calls this directly

Calls 3

CopyMethod · 0.80
OpenMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected