Skip to content

Commit

Permalink
Merge branch 'main' into support/3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dsuch committed Sep 16, 2023
2 parents f72142f + 9f912c2 commit 2b46b87
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from zato.common.exception import Inactive, TimeoutException
from zato.common.json_internal import dumps, loads
from zato.common.marshal_.api import Model
from zato.common.typing_ import cast_
from zato.common.util.api import get_component_name
from zato.common.util.open_ import open_rb
from zato.server.connection.queue import ConnectionQueue
Expand Down Expand Up @@ -498,7 +499,7 @@ def http_request(
if model:
response.data = self.server.marshal_api.from_dict(None, response.data, model) # type: ignore

return response
return cast_('Response', response)

# ################################################################################################################################

Expand Down Expand Up @@ -584,7 +585,10 @@ def get_by_query_id(
else:

# .. log what we received ..
logger.info('Get By Query ID response received -> %s', response)
logger.info('Get By Query ID response received -> %s', response.text)

if not response.ok:
raise Exception(response.text)

# .. extract the underlying data ..
data = response.data # type: ignore
Expand Down
30 changes: 22 additions & 8 deletions code/zato-server/src/zato/server/service/internal/http_soap.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,13 @@ def handle(self):
input.data_encoding = input.get('data_encoding') or 'utf-8'
input.hl7_version = input.get('hl7_version') or HL7.Const.Version.v2.id

# Remove extra whitespace
input.name = input.name.strip()
input.host = input.host.strip()
input.url_path = input.url_path.strip()
input.ping_method = input.get('ping_method', '').strip() or DEFAULT_HTTP_PING_METHOD
input.content_type = input.get('content_type', '').strip()

if input.content_encoding and input.content_encoding != 'gzip':
raise Exception('Content encoding must be empty or equal to `gzip`')

Expand Down Expand Up @@ -328,19 +335,19 @@ def handle(self):
item.host = input.host
item.url_path = input.url_path
item.method = input.method
item.soap_action = input.soap_action
item.soap_action = input.soap_action.strip()
item.soap_version = input.soap_version or None
item.data_format = input.data_format
item.service = service
item.ping_method = input.get('ping_method') or DEFAULT_HTTP_PING_METHOD
item.ping_method = input.ping_method
item.pool_size = input.get('pool_size') or DEFAULT_HTTP_POOL_SIZE
item.merge_url_params_req = input.get('merge_url_params_req') or True
item.url_params_pri = input.get('url_params_pri') or URL_PARAMS_PRIORITY.DEFAULT
item.params_pri = input.get('params_pri') or PARAMS_PRIORITY.DEFAULT
item.serialization_type = input.get('serialization_type') or HTTP_SOAP_SERIALIZATION_TYPE.DEFAULT.id
item.timeout = input.timeout
item.has_rbac = input.get('has_rbac') or input.sec_use_rbac or False
item.content_type = input.get('content_type')
item.content_type = input.content_type
item.sec_use_rbac = input.sec_use_rbac
item.cache_id = input.get('cache_id') or None
item.cache_expiry = input.get('cache_expiry') or 0
Expand Down Expand Up @@ -454,6 +461,13 @@ def handle(self):
input.data_encoding = input.get('data_encoding') or 'utf-8'
input.hl7_version = input.get('hl7_version') or HL7.Const.Version.v2.id

# Remove extra whitespace
input.name = input.name.strip()
input.host = input.host.strip()
input.url_path = input.url_path.strip()
input.ping_method = input.get('ping_method', '').strip() or DEFAULT_HTTP_PING_METHOD
input.content_type = input.get('content_type', '').strip()

if input.content_encoding and input.content_encoding != 'gzip':
raise Exception('Content encoding must be empty or equal to `gzip`')

Expand Down Expand Up @@ -507,10 +521,10 @@ def handle(self):
old_http_method = item.method
old_http_accept = opaque.get('http_accept')

item.name = input.name
item.name = input.name.strip()
item.is_active = input.is_active
item.host = input.host
item.url_path = input.url_path
item.host = input.host.strip()
item.url_path = input.url_path.strip()
item.security_id = input.security_id or None # So that SQLite does not reject ''
item.connection = input.connection
item.transport = input.transport
Expand All @@ -520,15 +534,15 @@ def handle(self):
item.soap_version = input.soap_version or None
item.data_format = input.data_format
item.service = service
item.ping_method = input.get('ping_method') or DEFAULT_HTTP_PING_METHOD
item.ping_method = input.ping_method
item.pool_size = input.get('pool_size') or DEFAULT_HTTP_POOL_SIZE
item.merge_url_params_req = input.get('merge_url_params_req') or False
item.url_params_pri = input.get('url_params_pri') or URL_PARAMS_PRIORITY.DEFAULT
item.params_pri = input.get('params_pri') or PARAMS_PRIORITY.DEFAULT
item.serialization_type = input.get('serialization_type') or HTTP_SOAP_SERIALIZATION_TYPE.DEFAULT.id
item.timeout = input.get('timeout')
item.has_rbac = input.get('has_rbac') or input.sec_use_rbac or False
item.content_type = input.get('content_type')
item.content_type = input.content_type
item.sec_use_rbac = input.sec_use_rbac
item.cache_id = input.get('cache_id') or None
item.cache_expiry = input.get('cache_expiry') or 0
Expand Down

0 comments on commit 2b46b87

Please sign in to comment.