Fix headers type check in Sandbox SDK request function (#21746)

* Fix headers type check in sandbox request function

* Add changeset
This commit is contained in:
Pascal Jufer
2024-03-08 09:23:30 +01:00
committed by GitHub
parent 9f1a403c98
commit 6aebecde72
2 changed files with 7 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
---
"@directus/api": patch
---
Fixed the type check for `headers` in the Sandbox SDK request function

View File

@@ -51,8 +51,8 @@ export function requestGenerator(requestedScopes: ExtensionSandboxRequestedScope
throw new TypeError('Request body has to be of type string or object');
}
if (headers !== undefined && headers.typeof !== 'undefined' && headers.typeof !== 'array') {
throw new TypeError('Request headers has to be of type array');
if (headers !== undefined && headers.typeof !== 'undefined' && headers.typeof !== 'object') {
throw new TypeError('Request headers has to be of type object');
}
const methodCopied = await method?.copy();