fix: http

This commit is contained in:
Yeuoly
2024-03-14 11:35:51 +08:00
committed by takatost
parent 44c4d5be72
commit 6633a92e1a
4 changed files with 79 additions and 5 deletions

View File

@ -33,7 +33,7 @@ class HttpRequestNodeData(BaseNodeData):
return v
class Body(BaseModel):
type: Literal[None, 'form-data', 'x-www-form-urlencoded', 'raw', 'json']
type: Literal['none', 'form-data', 'x-www-form-urlencoded', 'raw', 'json']
data: Union[None, str]
variables: list[VariableSelector]

View File

@ -131,8 +131,6 @@ class HttpExecutor:
self.headers['Content-Type'] = 'application/json'
elif node_data.body.type == 'x-www-form-urlencoded':
self.headers['Content-Type'] = 'application/x-www-form-urlencoded'
# elif node_data.body.type == 'form-data':
# self.headers['Content-Type'] = 'multipart/form-data'
if node_data.body.type in ['form-data', 'x-www-form-urlencoded']:
body = {}
@ -152,8 +150,10 @@ class HttpExecutor:
}
else:
self.body = urlencode(body)
else:
elif node_data.body.type in ['json', 'raw']:
self.body = original_body
elif node_data.body.type == 'none':
self.body = ''
def _assembling_headers(self) -> dict[str, Any]:
authorization = deepcopy(self.authorization)

View File

@ -42,7 +42,7 @@ class HttpRequestNode(BaseNode):
inputs=variables,
outputs={
'status_code': response.status_code,
'body': response,
'body': response.body,
'headers': response.headers
},
process_data={