fix: correct jsonEscape logic and trim headers in fetch template processing (#4736)

* fix: correct jsonEscape logic in fetch template processing

* fix: trim processed headers keys and values in fetch template processing
This commit is contained in:
Whitewater 2025-11-19 16:00:41 +08:00 committed by GitHub
parent 9a638b509c
commit 8ba1bef397
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -182,13 +182,13 @@ export class CustomIntegrationManager {
const processedKey = this.replacePlaceholders(key, context)
const processedValue = this.replacePlaceholders(value, context)
// Field names are case-insensitive.
processedHeaders[processedKey.toLowerCase()] = processedValue
processedHeaders[processedKey.toLowerCase().trim()] = processedValue.trim()
})
// Process body without URL encoding
let processedBody: string | undefined
if (fetchTemplate.body) {
const jsonEscape = fetchTemplate.headers["content-type"]?.toLowerCase() === "application/json"
const jsonEscape = processedHeaders["content-type"]?.toLowerCase() === "application/json"
processedBody = this.replacePlaceholders(fetchTemplate.body, context, { jsonEscape })
}