mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-13 04:49:01 +08:00
fix: HTTP request header is overwritten when user set Content-Type (#5628)
This commit is contained in:
parent
dcb72e0067
commit
92c56fdf2b
@ -168,9 +168,10 @@ class HttpExecutor:
|
||||
if body_data:
|
||||
body_data, body_data_variable_selectors = self._format_template(body_data, variable_pool, is_valid_json)
|
||||
|
||||
if node_data.body.type == 'json':
|
||||
content_type_is_set = any(key.lower() == 'content-type' for key in self.headers)
|
||||
if node_data.body.type == 'json' and not content_type_is_set:
|
||||
self.headers['Content-Type'] = 'application/json'
|
||||
elif node_data.body.type == 'x-www-form-urlencoded':
|
||||
elif node_data.body.type == 'x-www-form-urlencoded' and not content_type_is_set:
|
||||
self.headers['Content-Type'] = 'application/x-www-form-urlencoded'
|
||||
|
||||
if node_data.body.type in ['form-data', 'x-www-form-urlencoded']:
|
||||
|
Loading…
x
Reference in New Issue
Block a user