描述問題/錯誤/問題
錯誤訊息是什麼(如果有)? 錯誤的請求 - 請檢查您的參數
請分享您的工作流程
{
“nodes”: [
{
“parameters”: {
“method”: “POST”,
“url”: “http://host.docker.internal:8082/api/assistant/intent”,
“sendHeaders”: true,
“headerParameters”: {
“parameters”: [
{
“name”: “Content-Type”,
“value”: “application/json”
},
{
“name”: “Accept”,
“value”: “application/json”
}
]
},
“sendBody”: true,
“contentType”: “raw”,
“body”: “={{ $json.cleanOutput }}”,
“options”: {}
},
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.4,
“position”: [
240,
-112
],
“id”: “bc555ae5-8565-4c9b-b871-4d3f4a20899b”,
“name”: “HTTP Request”
}
],
“connections”: {},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “02f1001f8f2d972f69be23b2f2dcfdcc65885dd6f6ff6d04c911329ee6f7f3dd”
}
}
您的 n8n 設定相關資訊
- n8n 版本:最新版 / 本機
- 資料庫(預設:SQLite):N/A
- n8n EXECUTIONS_PROCESS 設定(預設:own、main):預設
- 透過以下方式執行 n8n(Docker、npm、n8n cloud、桌面應用程式):Docker
- 作業系統:Windows 10
嗨 @GeoForeman
將你的 Body 欄位改為:
{
"intent": "{{ $json.cleanOutput }}"
}
(用你的 API 所需的實際金鑰名稱取代 "intent")。
嗨 @GeoForeman 歡迎!
內容類型 raw 會將表達式的字面值作為請求體發送。如果 cleanOutput 還不是有效的 JSON,host.docker.internal:8082 會在 Content-Type: application/json 標頭下接收純文本,其解析器會在你的端點邏輯運行之前拒絕它。
使用 JSON.stringify 包裝該值,而不是在表達式周圍手動加引號,因為手動引號在 cleanOutput 包含引號或換行符時會立即失效:
{{ JSON.stringify({ yourKey: $json.cleanOutput }) }}
由於這是你自己的本地服務,其實際響應體或伺服器日誌會顯示真實的驗證原因,而不是 n8n 的通用訊息。