diff --git a/airbyte_cdk/sources/declarative/requesters/request_options/interpolated_request_options_provider.py b/airbyte_cdk/sources/declarative/requesters/request_options/interpolated_request_options_provider.py index cc961fae7..26f796f36 100644 --- a/airbyte_cdk/sources/declarative/requesters/request_options/interpolated_request_options_provider.py +++ b/airbyte_cdk/sources/declarative/requesters/request_options/interpolated_request_options_provider.py @@ -99,9 +99,11 @@ def _resolve_request_body(self) -> None: if self.request_body is not None and self.request_body.type is not None: if self.request_body.type == "RequestBodyUrlEncodedForm": self.request_body_data = self.request_body.value + elif self.request_body.type == "RequestBodyPlainText": + self.request_body_data = self.request_body.value elif self.request_body.type == "RequestBodyGraphQL": self.request_body_json = self.request_body.value.dict(exclude_none=True) - elif self.request_body.type in ("RequestBodyJsonObject", "RequestBodyPlainText"): + elif self.request_body.type == "RequestBodyJsonObject": self.request_body_json = self.request_body.value else: raise ValueError(f"Unsupported request body type: {self.request_body.type}") diff --git a/unit_tests/sources/declarative/requesters/request_options/test_interpolated_request_options_provider.py b/unit_tests/sources/declarative/requesters/request_options/test_interpolated_request_options_provider.py index 786807aa6..2a756adff 100644 --- a/unit_tests/sources/declarative/requesters/request_options/test_interpolated_request_options_provider.py +++ b/unit_tests/sources/declarative/requesters/request_options/test_interpolated_request_options_provider.py @@ -211,14 +211,6 @@ def test_interpolated_request_json(test_name, input_request_json, expected_reque RequestBodyJsonObject(type="RequestBodyJsonObject", value={"none_value": "{{ None }}"}), {}, ), - ( - "test_string", - RequestBodyPlainText( - type="RequestBodyPlainText", - value="""{"nested": { "key": "{{ config['option'] }}" }}""", - ), - {"nested": {"key": "OPTION"}}, - ), ( "test_nested_objects", RequestBodyJsonObject( @@ -345,6 +337,14 @@ def test_interpolated_request_data(test_name, input_request_data, expected_reque ), {"2020-01-01 - 12345": "ABC"}, ), + ( + "test_plain_text_body", + RequestBodyPlainText( + type="RequestBodyPlainText", + value="plain text body with {{ config['option'] }}", + ), + "plain text body with OPTION", + ), ], ) def test_interpolated_request_data_using_request_body(