Issue with Header Format for HttpService:RequestAsync() When Sending Requests to Azure Cosmos DB

  1. What I want to achieve
    I want to successfully send an HTTP request from Roblox to Azure Cosmos DB using HttpService:RequestAsync() with the required header format, including ["x-ms-documentdb-partitionkey"] as an array.

  2. Detail of the issue
    When I attempt to include the ["x-ms-documentdb-partitionkey"] header as an array, I encounter the following error in the Roblox Studio console:
    Header "x-ms-documentdb-partitionkey" has unallowed character "[" in value "["test"]".

However, according to the Azure Cosmos DB documentation, this header must be passed as an array. This creates a conflict, as Roblox’s HttpService does not seem to accept headers in this format.

Here’s an example of my current code:

Headers = {
    ["Authorization"] = authorization,
    ["x-ms-version"] = "20**-**-**", 
    ["x-ms-date"] = date, 
    ["x-ms-documentdb-partitionkey"] = ["test"], 
}
  1. Solutions I have tried so far
    I’ve attempted the following approaches:
  • Changing the format of the header to a string (e.g., "[\"test\"]"), but this does not meet the Cosmos DB requirements.

arrays in lua(u) are made using { and } not [ and ] like in JSON.
The documentation is probably explained in JSON, try changing it to

 ["x-ms-documentdb-partitionkey"] = {"test"}

Thank you for the suggestion. I tried changing it to:

["x-ms-documentdb-partitionkey"] = {"test"}

However, I received the following error:
Header "x-ms-documentdb-partitionkey" must have its value be a string or secret!

It seems like HttpService is not accepting the array format, even when using {} in Lua.