Skip to content
Open
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
5 changes: 3 additions & 2 deletions custom-recipes/api-connect/recipe.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@
"defaultValue": null,
"selectChoices":[
{"value": null, "label": "None"},
{"value": "FORM_DATA", "label": "Form-data"},
{"value": "FORM_DATA", "label": "Form-data (Json)"},
{"value": "MULTIPART_FORM_DATA", "label": "Multipart Form-data"},
{"value": "RAW", "label": "Raw"}
]
},
Expand All @@ -150,7 +151,7 @@
"label": "Request's body",
"description": "",
"type": "KEY_VALUE_LIST",
"visibilityCondition": "(['FORM_DATA'].indexOf(model.body_format)>-1)"
"visibilityCondition": "(['FORM_DATA', 'MULTIPART_FORM_DATA'].includes(model.body_format))"
},

{
Expand Down
5 changes: 3 additions & 2 deletions python-connectors/api-connect_dataset/connector.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@
"defaultValue": null,
"selectChoices":[
{"value": null, "label": "None"},
{"value": "FORM_DATA", "label": "Form-data"},
{"value": "FORM_DATA", "label": "Form-data (Json)"},
{"value": "MULTIPART_FORM_DATA", "label": "Multipart Form-data"},
{"value": "RAW", "label": "Raw"}
]
},
Expand All @@ -136,7 +137,7 @@
"label": "Request's body",
"description": "",
"type": "KEY_VALUE_LIST",
"visibilityCondition": "(['FORM_DATA'].indexOf(model.body_format)>-1)"
"visibilityCondition": "(['FORM_DATA', 'MULTIPART_FORM_DATA'].includes(model.body_format))"
},
{
"type": "SEPARATOR",
Expand Down
1 change: 1 addition & 0 deletions python-lib/dku_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ class DKUConstants(object):
FORM_DATA_BODY_FORMAT = "FORM_DATA"
PLUGIN_VERSION = "1.3.0"
RAW_BODY_FORMAT = "RAW"
MULTIPART_FORM_DATA_BODY_FORMAT = "MULTIPART_FORM_DATA"
REPONSE_ERROR_KEY = "dku_error"
3 changes: 3 additions & 0 deletions python-lib/rest_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ def __init__(self, credential, secure_credentials, endpoint, custom_key_values={
elif body_format in [DKUConstants.FORM_DATA_BODY_FORMAT]:
key_value_body = endpoint.get("key_value_body", {})
self.requests_kwargs.update({"json": get_dku_key_values(key_value_body)})
elif body_format in [DKUConstants.MULTIPART_FORM_DATA_BODY_FORMAT]:
key_value_body = endpoint.get("key_value_body", {})
self.requests_kwargs.update({"files": {k: (None, v) for k, v in get_dku_key_values(key_value_body).items()}})
self.metadata = {}
if self.behaviour_when_error == "keep-error-column":
self.metadata = {DKUConstants.REPONSE_ERROR_KEY: None}
Expand Down
4 changes: 4 additions & 0 deletions tests/python/integration/test_scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,7 @@ def test_run_api_connect_parameters_renaming(user_dss_clients):

def test_run_api_connect_mtls(user_dss_clients):
dss_scenario.run(user_dss_clients, project_key=TEST_PROJECT_KEY, scenario_id="MTLS")


def test_run_api_connect_multipart_form_data(user_dss_clients):
dss_scenario.run(user_dss_clients, project_key=TEST_PROJECT_KEY, scenario_id="MULTIPARTFORMDATA")