Custom header with MSXML2.ServerXMLHTTP
<p>I am currently trying to use MSXML2.ServerXMLHTTP to send a POST http request.
I need to add a custom header "Auth" so that my requests get authorized but it doesn't seem to work. 
Here is the code for my post function:</p>

<pre><code>Function post(path As String, authToken As String, postData As String) As String
  Dim xhr As Object
  Dim message As String
On Error GoTo error:

  Set xhr = CreateObject("MSXML2.ServerXMLHTTP")
  xhr.Open "POST", path, False
  xhr.setRequestHeader "Content-Type", "application/json"
  xhr.setRequestHeader "Auth", authToken
  xhr.send postData

  If xhr.Status = 200 Then
    message = xhr.responseText
  Else
    message = xhr.Status &amp; ": " &amp; xhr.statusText
  End If

  Set xhr = Nothing
  post = message
error:
  Debug.Print "Error " &amp; Err.Number; ":" &amp; Err.Description
End Function
</code></pre>

<p>And I end up with "Error -2147012746 Requested Header was not found" (The message is actually translated since I use a different language on my computer).</p>

<p>However I didn't have this problem with the "Microsoft.XMLHTTP" Object. 
Am I doing something wrong ?</p>

<p>Thank you for your time.</p>