This has been baffling me for a while. I'm trying to post JSON content to a webhook but need to use Classic ASP. I can do it using jquery but needs to be serverside. I've also tried using JScript which results in the same issue. Also tried a separate server
The script fundamentally works, If I set the Content-Type
to application/x-www-form-urlencoded
the posted content comes through fine, but as soon as I change to application/json
the content disappears (the request makes it though as I can inspect the headers at the other end)
strEnvelope = "{""content"":""Serverside Test Post"",""embeds"": [{""description"":""Now to grab and extract content""}]}"
data = "content="&Server.URLEncode(strEnvelope)
dim xmlhttp
set xmlhttp = server.Createobject("Microsoft.XMLHTTP")
xmlhttp.Open "POST","https://discordapp.com/api/webhooks/000000000000/key",false
'xmlhttp.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp.setRequestHeader "Content-Type", "application/json"
xmlhttp.send(data)
Response.Write xmlhttp.ResponseText
Set xmlhttp = nothing
Any thoughts much appreciated, it's weird as all I'm doing is changing the Content-Type
header