Skip to content

Commit

Permalink
Merge pull request #109 from microsoft/feature/multi-content-types
Browse files Browse the repository at this point in the history
 - adds a method to specify the content type of the binary request body
  • Loading branch information
baywet authored Oct 11, 2023
2 parents ddce95a + 796c00b commit 073a3b3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

## [1.3.0] - 2023-10-12

### Added

- Added an overload method to set binary content with their content type.

## [1.2.3] - 2023-10-05

### Added
Expand Down
8 changes: 7 additions & 1 deletion request_information.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,16 @@ const contentTypeHeader = "Content-Type"
const binaryContentType = "application/octet-steam"

// SetStreamContent sets the request body to a binary stream.
// Deprecated: Use SetStreamContentAndContentType instead.
func (request *RequestInformation) SetStreamContent(content []byte) {
request.SetStreamContentAndContentType(content, binaryContentType)
}

// SetStreamContentAndContentType sets the request body to a binary stream with the specified content type.
func (request *RequestInformation) SetStreamContentAndContentType(content []byte, contentType string) {
request.Content = content
if request.Headers != nil {
request.Headers.Add(contentTypeHeader, binaryContentType)
request.Headers.Add(contentTypeHeader, contentType)
}
}

Expand Down

0 comments on commit 073a3b3

Please sign in to comment.