I have a function that creates an authentication header for OAuth 2 authentication. The header itself is quite simple: it just has one key pair.
Inside the function, the header is a hashtable. When the hashtable is read by the calling expression, it has become an object. By converting them both to JSON I can see that an empty string has been inserted before the array, and so the object has become an array object.
You can see this clearly in the output:
[
"",
{
"Authorization": "Bearer xyzabc123"
}
]
Inside the function, the object just has the part inside the {} and is a hashtable. How did it get the extra “”?
As an extra problem, this happens if I request a token interactively. In EXACTLY the same function, if I request the token non-interactively, the object is returned as a hashtable and the receiving expression works fine.