我想使用此方法将数据发布到Jira:
Private IEService As New MSXML2.XMLHTTP60
Public Function httpPOST(baseUrl As String, url As String, jsonInput As String, auth As String) As String
Dim accept As String
accept = "application/json"
With IEService
.Open "POST", baseUrl & url, False
.setRequestHeader "Content-Type", "application/json"
.setRequestHeader "Accept", accept
.setRequestHeader "Authorization", "Basic " & auth
.setRequestHeader "Origin", baseUrl
.send jsonInput
httpPOST = .responseText
'MsgBox (.responseText)
End With
End Function
数据很好,POST在后端执行。但是Jira在这个实例中返回一个空响应体。 发生这种情况时,VBA在 .send jsonInput 上崩溃并出现错误:运行时错误-2147467260
似乎MSXML2不处理空响应。但我没有发现任何人在网上搜索同样的问题。 我有什么想法或者如何解决它? 感谢