From 8d2a7a13cd1a624a433fb056671e73359e695ab7 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 11 Oct 2023 09:48:25 -0400 Subject: [PATCH 1/2] - adds content type parameter to set stream content --- CHANGELOG.md | 7 +++++++ kiota_abstractions/_version.py | 2 +- kiota_abstractions/request_information.py | 8 ++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d45a724..18a1f89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/kiota_abstractions/_version.py b/kiota_abstractions/_version.py index 538ada5..271f286 100644 --- a/kiota_abstractions/_version.py +++ b/kiota_abstractions/_version.py @@ -1 +1 @@ -VERSION: str = "0.8.7" +VERSION: str = "0.8.8" diff --git a/kiota_abstractions/request_information.py b/kiota_abstractions/request_information.py index 091c700..2cbc960 100644 --- a/kiota_abstractions/request_information.py +++ b/kiota_abstractions/request_information.py @@ -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: Optional[str]) -> 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: From 655c0bc6b25003deeb9ebd10cf4ab5bc05d60982 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 18 Oct 2023 08:46:19 -0400 Subject: [PATCH 2/2] Update kiota_abstractions/request_information.py --- kiota_abstractions/request_information.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kiota_abstractions/request_information.py b/kiota_abstractions/request_information.py index 2cbc960..e436ba4 100644 --- a/kiota_abstractions/request_information.py +++ b/kiota_abstractions/request_information.py @@ -227,7 +227,7 @@ 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, content_type: Optional[str]) -> None: + def set_stream_content(self, value: BytesIO, content_type: str = None) -> None: """Sets the request body to be a binary stream. Args: