Could be a problem if 204 does not send Content-Length header.
Do you reuse the request object or create a fresh instance on each request?
Edit: Try latest 1.0.2 release for fixed status 204 handling
cheers,
</wqw>
Printable View
Could be a problem if 204 does not send Content-Length header.
Do you reuse the request object or create a fresh instance on each request?
Edit: Try latest 1.0.2 release for fixed status 204 handling
cheers,
</wqw>
Amazingness - it works beautifully <3 <3
FTR, I tried both making a new instance and reusing the existing one with the previous DLL, and had the same timeout results.
And now I tried both ways and it worked fine both times. :)
So fwiw it works great in VBScript to retrieve a value from one API, get the values out of a JSON array which comes in called 'data', and then plug it into another API:
(For anyone else poking at it in VBScript, hope this will give some useful clues)
Code:Option Explicit
const apioauth = "myoauth"
const clientid = "myclientid"
Dim URL, userid
Const WinHttpRequestOption_SslErrorIgnoreFlags = 4
Const SslErrorFlag_UnknownCA = 256
With createObject("HttpRequest.cHttpRequest")
URL = "https://xxxxxx/variable=" & WScript.Arguments(1)
.open_ "GET",URL,false
.Option_(WinHttpRequestOption_SslErrorIgnoreFlags) = SslErrorFlag_UnknownCA
.setRequestHeader "Client-Id", clientid
.setRequestHeader "Authorization", "Bearer " & apioauth
.send
msgbox "response: " & .responseText
Dim y, html : Set html = CreateObject("htmlfile")
Dim w : Set w = html.parentWindow
w.execScript "var json=" & .responseText & ";var e=new Enumerator(json.data);", "JScript"
While Not w.e.atEnd()
Set y = w.e.item()
userid=y.id
w.e.moveNext
Wend
URL = "https://xxxxx"
If WScript.Arguments(0) = 1 Then
.open_ "POST",URL,false
Else
.open_ "DELETE",URL,false
End If
.Option_(WinHttpRequestOption_SslErrorIgnoreFlags) = SslErrorFlag_UnknownCA
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.setRequestHeader "Authorization", "Bearer " & apioauth
.setRequestHeader "Client-ID", clientid
.send "var=value&var=" & userid
msgbox "response: " & .responseText
End With
(Of course a Const OAuth is like a jumbo shrimp, it might be a thing but eh? ... it's just for testing)
Vladimir, can I contact you about a VB question? Are you available for some consulting? I have an image upload function that is giving an error when I'm using SSL from Amazon, but works fine when using SSL installed on my own server.