refactor(api/core/workflow/nodes/http_request): Remove mask_authorization_header because its alwary true. (#6379)

This commit is contained in:
-LAN- 2024-07-17 16:52:14 +08:00 • committed by GitHub
commit fc37887a21
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 17 additions and 34 deletions

View file

@ -58,4 +58,3 @@ class HttpRequestNodeData(BaseNodeData):
params: str
body: Optional[HttpRequestNodeBody] = None
timeout: Optional[HttpRequestNodeTimeout] = None
mask_authorization_header: Optional[bool] = True

View file

@ -283,7 +283,7 @@ class HttpExecutor:
# validate response
return self._validate_and_parse_response(response)
def to_raw_request(self, mask_authorization_header: Optional[bool] = True) -> str:
def to_raw_request(self) -> str:
"""
convert to raw request
"""
@ -295,16 +295,15 @@ class HttpExecutor:
headers = self._assembling_headers()
for k, v in headers.items():
if mask_authorization_header:
# get authorization header
if self.authorization.type == 'api-key':
authorization_header = 'Authorization'
if self.authorization.config and self.authorization.config.header:
authorization_header = self.authorization.config.header
# get authorization header
if self.authorization.type == 'api-key':
authorization_header = 'Authorization'
if self.authorization.config and self.authorization.config.header:
authorization_header = self.authorization.config.header
if k.lower() == authorization_header.lower():
raw_request += f'{k}: {"*" * len(v)}\n'
continue
if k.lower() == authorization_header.lower():
raw_request += f'{k}: {"*" * len(v)}\n'
continue
raw_request += f'{k}: {v}\n'

View file

@ -65,9 +65,7 @@ class HttpRequestNode(BaseNode):
process_data = {}
if http_executor:
process_data = {
'request': http_executor.to_raw_request(
mask_authorization_header=node_data.mask_authorization_header
),
'request': http_executor.to_raw_request(),
}
return NodeRunResult(
status=WorkflowNodeExecutionStatus.FAILED,
@ -86,9 +84,7 @@ class HttpRequestNode(BaseNode):
'files': files,
},
process_data={
'request': http_executor.to_raw_request(
mask_authorization_header=node_data.mask_authorization_header,
),
'request': http_executor.to_raw_request(),
},
)