diff --git a/CHANGELOG.md b/CHANGELOG.md index 016b32a..a033b26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +## [1.4.0] - 2024-03-07 + +### Added + +- Returns an `io.ReadCloser` for streamed responses, allows passing an `io.ReadCloser` to request information. + +### Changed + ## [1.3.2] - 2024-02-28 ### Changed diff --git a/nethttp_request_adapter.go b/nethttp_request_adapter.go index c140636..a370146 100644 --- a/nethttp_request_adapter.go +++ b/nethttp_request_adapter.go @@ -278,6 +278,9 @@ func (a *NetHttpRequestAdapter) getRequestFromRequestInformation(ctx context.Con reader := bytes.NewReader(requestInfo.Content) request.Body = NopCloser(reader) } + if requestInfo.ContentReader != nil { + request.Body = requestInfo.ContentReader + } if request.Header == nil { request.Header = make(nethttp.Header) } @@ -575,6 +578,9 @@ func (a *NetHttpRequestAdapter) SendPrimitive(ctx context.Context, requestInfo * } return res, nil } + if typeName == "io.ReadCloser" { + return response.Body, nil + } parseNode, _, err := a.getRootParseNode(ctx, response, span) if err != nil { return nil, err