Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- adds a method to specify the content type of the binary request body #109

Merged
merged 1 commit into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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