mirror of
https://github.com/langgenius/dify.git
synced 2026-05-03 00:48:04 +08:00
fix: http
This commit is contained in:
@ -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]
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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={
|
||||
|
||||
Reference in New Issue
Block a user