Versions in this module Expand all Collapse all v0 v0.28.0 Aug 25, 2026 Changes in this version + var ErrBodyAlreadyOpen = errors.New("request body has already been opened") + var ErrNotReplayable = errors.New("request body is not replayable") + func Attach(req *http.Request, b *Body) + func WithSource(ctx context.Context, b *Body) context.Context + type Body struct + func NewBytes(data []byte, contentType string) *Body + func NewFactory(open func() (io.ReadCloser, error), length int64, contentType string, ...) *Body + func NewFile(path, contentType string) (*Body, error) + func NewFileFromOpenFile(f *os.File, contentType string) (body *Body, err error) + func NewReader(r io.Reader, length int64, contentType string) *Body + func NewReaderAt(r io.ReaderAt, offset, length int64, contentType string) *Body + func NewSeekable(r io.ReadSeeker, offset, length int64, contentType string) *Body + func SourceFromContext(ctx context.Context) (*Body, bool) + func (b *Body) Close() error + func (b *Body) ContentLength() int64 + func (b *Body) ContentType() string + func (b *Body) Materialize(max int64) ([]byte, error) + func (b *Body) Open() (io.ReadCloser, error) + func (b *Body) Preview(max int64) (Preview, error) + func (b *Body) Read(p []byte) (int, error) + func (b *Body) Replay() (io.ReadCloser, error) + func (b *Body) Replayable() bool + func (b *Body) SetCleanup(cleanup func() error) + type Preview struct + Data []byte + Truncated bool + type Stream struct + func NewStream(source io.ReadCloser) *Stream + func (s *Stream) AddTee(w io.Writer) + func (s *Stream) Close() error + func (s *Stream) ProgressBytes() (int64, bool) + func (s *Stream) Read(p []byte) (int, error)