Skip to content

Commit

Permalink
Adds read content value
Browse files Browse the repository at this point in the history
  • Loading branch information
rkodev committed Mar 7, 2024
1 parent 78ed8cc commit e6cc2ad
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

## [1.3.1] - 2024-02-09
## [1.4.0] - 2024-03-07

### Added

- Returns an `io.ReadCloser` for streamed responses, allows passing an `io.ReadCloser` to request information.

## [1.3.1] - 2024-02-09

### Changed

- Fix bug that resulted in the error "content is empty" being returned instead of HTTP status information if the request returned no content and an unsuccessful status code.
Expand Down
6 changes: 6 additions & 0 deletions nethttp_request_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e6cc2ad

Please sign in to comment.