fix: validate response type in transform_response method (#11931)
Signed-off-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
parent
0b06235527
commit
5e37ab60d8
1 changed files with 5 additions and 2 deletions
|
|
@ -33,13 +33,16 @@ class TemplateTransformer(ABC):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def transform_response(cls, response: str) -> dict:
|
def transform_response(cls, response: str):
|
||||||
"""
|
"""
|
||||||
Transform response to dict
|
Transform response to dict
|
||||||
:param response: response
|
:param response: response
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
return json.loads(cls.extract_result_str_from_response(response))
|
result = json.loads(cls.extract_result_str_from_response(response))
|
||||||
|
if not isinstance(result, dict):
|
||||||
|
raise ValueError("Result must be a dict")
|
||||||
|
return result
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue