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 10, 2023
2 parents 1099220 + 72155f2 commit 150c770
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
2 changes: 2 additions & 0 deletions code/zato-common/src/zato/common/marshal_/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ def _zato_from_dict(class_, data, extra=None):
api = MarshalAPI()
return api.from_dict(cast_('Service', None), data, class_, extra=extra)

from_dict = _zato_from_dict

def to_dict(self):
return asdict(self)

Expand Down
2 changes: 1 addition & 1 deletion code/zato-common/src/zato/common/util/time_.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class TimeUtil:

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

def now(self, format=ModuleCtx.Date_Time_Format, tz=local_tz_zone, needs_format=True, delta=None):
def now(self, format=ModuleCtx.Date_Time_Format, tz=local_tz_zone, needs_format=True, delta=None) -> 'str | datetime':
""" Returns now in a specified timezone.
"""
now = arrow.now(tz=tz)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from parse import PARSE_RE

# requests
from requests import Response as _RequestsResponse
from requests.adapters import HTTPAdapter
from requests.exceptions import Timeout as RequestsTimeout
from requests.sessions import Session as RequestsSession
Expand All @@ -42,9 +43,8 @@
# ################################################################################################################################

if 0:
from requests import Response
from sqlalchemy.orm.session import Session as SASession
from zato.common.typing_ import any_, dictnone, stranydict, strstrdict
from zato.common.typing_ import any_, dictnone, stranydict, stranydictnone, strstrdict
from zato.server.base.parallel import ParallelServer
from zato.server.config import ConfigDict
ConfigDict = ConfigDict
Expand Down Expand Up @@ -75,6 +75,12 @@
# ################################################################################################################################
# ################################################################################################################################

class Response(_RequestsResponse):
data: 'stranydictnone'

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

class HTTPSAdapter(HTTPAdapter):
""" An adapter which exposes a method for clearing out the underlying pool. Useful with HTTPS as it allows to update TLS
material on the fly.
Expand Down Expand Up @@ -132,7 +138,7 @@ def invoke_http(
hooks:'any_',
*args:'any_',
**kwargs:'any_'
) -> 'Response':
) -> '_RequestsResponse':

json = kwargs.pop('json', None)
cert = self.config['tls_key_cert_full_path'] if self.sec_type == _TLS_Key_Cert else None
Expand Down
4 changes: 4 additions & 0 deletions code/zato-server/src/zato/server/service/internal/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,10 @@ def _get_payload_from_extra(self, payload:'any_') -> 'strnone':
if isinstance(payload, bytes):
payload = payload.decode('utf8')

# .. ignore payload that seems to be JSON ..
if '{' in payload or '}' in payload:
return

payload = payload[1:-1]
payload = payload.replace('\\n', '\n')
payload = parse_extra_into_dict(payload)
Expand Down

0 comments on commit 150c770

Please sign in to comment.