Skip to content

Commit

Permalink
default header fix, custom auth fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kudj committed Jan 7, 2025
1 parent 7ba976f commit 9c8f8f3
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 5 deletions.
9 changes: 4 additions & 5 deletions python-sync-actions/src/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,9 @@ def _remove_auth_from_dict(dictionary: dict, to_remove: list) -> dict:
filtered_dict = {}
for key, value in dictionary.items():
if isinstance(value, dict):
if key != 'Authorization':
filtered_value = _remove_auth_from_dict(value, to_remove)
if filtered_value:
filtered_dict[key] = filtered_value
filtered_value = _remove_auth_from_dict(value, to_remove)
if filtered_value:
filtered_dict[key] = filtered_value
else:
if value not in to_remove:
filtered_dict[key] = value
Expand Down Expand Up @@ -380,7 +379,7 @@ def convert(cls, config_parameters: dict) -> Authentication | None:
auth_method = config_parameters.get('config', {}).get('__AUTH_METHOD', None)
# or take it form the authentication section
auth_method = auth_method or config_parameters.get('api', {}).get('authentication', {}).get('type')
if not auth_method:
if not auth_method or auth_method == 'custom':
return None

methods = {
Expand Down
57 changes: 57 additions & 0 deletions python-sync-actions/tests/calls/010-default-header/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"storage": {},
"parameters": {
"__SELECTED_JOB": "0",

"config": {
"jobs": [
{
"__NAME": "orders",
"endpoint": "010-default-header/orders",
"method": "GET",
"dataType": "",
"dataField": "nested.orders"
}
],
"test": "test-value",
"concat": {
"function": "concat",
"args": [
"hello",
"-world"
]
},
"debug": false,
"outputBucket": "in.c-",
"incrementalOutput": false,
"#BEARER_TOKEN": "token"
},
"api": {
"baseUrl": "http://mock-server:80/",
"http": {
"headers": {
"Authorization": {
"attr": "#BEARER_TOKEN"
}
}
}
},
"http": {
"maxRetries": 10,
"codes": [
500,
502,
503,
504,
408,
420,
429
]
}
},
"action": "test_request",
"image_parameters": {
},
"authorization": {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GET /010-default-header/orders
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
accept: */*
authorization: Bearer token
82 changes: 82 additions & 0 deletions python-sync-actions/tests/calls/010-default-header/orders.response
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"nested": {
"orders": [
{
"id": 1,
"customer": "John Doe",
"address": "123 Main St",
"items": [
{
"id": 1,
"name": "Widget",
"price": 9.99,
"quantity": 2
},
{
"id": 2,
"name": "Thing",
"price": 5.99,
"quantity": 5
}
]
},
{
"id": 2,
"customer": "Jan Novak",
"address": "123 Main St",
"items": [
{
"id": 1,
"name": "Widget",
"price": 9.99,
"quantity": 2
},
{
"id": 2,
"name": "Thing",
"price": 5.99,
"quantity": 5
}
]
},
{
"id": 3,
"customer": "Jana Novakova",
"address": "123 Main St",
"items": [
{
"id": 1,
"name": "Widget",
"price": 9.99,
"quantity": 2
},
{
"id": 2,
"name": "Thing",
"price": 5.99,
"quantity": 5
}
]
},
{
"id": 4,
"customer": "Bob Smith",
"address": "123 Main St",
"items": [
{
"id": 1,
"name": "Widget",
"price": 9.99,
"quantity": 2
},
{
"id": 2,
"name": "Thing",
"price": 5.99,
"quantity": 5
}
]
}
]
}
}

0 comments on commit 9c8f8f3

Please sign in to comment.