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 content type parameter to set stream content #158

Closed
wants to merge 2 commits into from
Closed
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.8.8] - 2023-10-12

### Added

- Added a content type parameter to the set stream content method in request information.

## [0.8.7] - 2023-10-05

### Added

- Added a try_add method for request headers

### Changed
Expand Down
2 changes: 1 addition & 1 deletion kiota_abstractions/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION: str = "0.8.7"
VERSION: str = "0.8.8"
8 changes: 6 additions & 2 deletions kiota_abstractions/request_information.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,17 @@ def set_content_from_scalar(
writer_func(None, values)
self._set_content_and_content_type_header(writer, content_type)

def set_stream_content(self, value: BytesIO) -> None:
def set_stream_content(self, value: BytesIO, content_type: str = None) -> None:
"""Sets the request body to be a binary stream.

Args:
value (BytesIO): the binary stream
content_type (Optional[str]): the content type
"""
self.try_add_request_header(self.CONTENT_TYPE_HEADER, self.BINARY_CONTENT_TYPE)
if not content_type:
content_type = self.BINARY_CONTENT_TYPE

self.try_add_request_header(self.CONTENT_TYPE_HEADER, content_type)
self.content = value

def set_query_string_parameters_from_raw_object(self, q: Optional[QueryParams]) -> None:
Expand Down
Loading