Recent searches
No recent searches
ZAF request proxy can send form data?
Answered
Posted Oct 05, 2021
I'd like to send form data from ZAF client using proxy.
I want to do like this.
curl -X POST "https://external.server/" -H "X-API-Key: ..." -H "Content-Type: application/x-www-form-urlencoded" -d 'test=1234'
but, if I do the following code, the parameter was converted to query string.
var options = {
url: "https://external.server/",
method: 'POST',
secure: true,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'X-API-Key': '{{setting.api_key}}'
},
data: "test=1234"
};
client.request(options);
The actual network request on browser had weird parameter.
POST https://mydomain.zendesk.com/proxy/v2/apps/secure/https://external.server/?0=t&1=e&2=s&3=t&4==&5=1&6=2&7=3&8=4
How is it possible?
1
4
4 comments
Leafworks Test Team
Hello Megumi,
Could you please specify the content type in contentType: 'application/x-www-form-urlencoded', instead of headers?
If it doesn't help, could you share more info from the Network tab about this request? Maybe it would help find out the issue. Because I think we can use form data in the ZAF request proxy.
0
Megumi Nakamura
Thanks Andriy,
I changed content type to contentType in param, but it doesn't help. Failed in the same result.
Network tab is below.
Address and response header. The decoded url is "https://con-eclect-nakamura.zendesk.com/proxy/v2/apps/secure/https://d856-2409-11-4260-bd00-7deb-ca46-32cb-c21f.ngrok.io/?0=t&1=e&2=s&3=t&4==&5=1&6=2&7=3&8=4".
Request header:
Could you find something wrong?
0
Leafworks Test Team
Hello Megumi,
I think the issue is in method:"POST". IT should be type: "POST" instead.
0
Megumi Nakamura
Hello Andriy, Thank you very much!
I could send the request!! Thanks!!
0