[英]Zapier Code FETCH POST action doesn't include body
I'm using Zaper's Code by Zapier to make an HTTP POST, but it appears the body is empty.我正在使用 Zapier 的 Zaper 代码进行 HTTP POST,但正文似乎是空的。 I've checked Zapier's docs and Node-Fetch , and it looks like my syntax is correct, yet when I inspect the request there appears to not be a body.
我检查了Zapier 的文档和Node-Fetch ,看起来我的语法是正确的,但是当我检查请求时,似乎没有正文。
var testendpoint = 'http://example.com';
var payload = {
'data': [
{
'Date': 'dateparsed',
'Signups': '1'
}
],
'color': {
'Signups': '#2fd75b'
}
};
fetch(testendpoint, {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify(payload)
}).then(function(response) {
return response.text();
}).then(function(responsebody) {
var output = {response: responsebody};
callback(null, output);
}).catch(function(error) {
callback(error);
});
After suffering the exact same issue, I got word back from Zapier Support that the issue was able to be replicated and we have indeed found a bug.在遇到完全相同的问题后,我从 Zapier Support 得到消息,该问题能够被复制,我们确实发现了一个错误。 They're looking into it and will notify me when fixed.
他们正在调查它,并在修复后通知我。 I'll post here when that happens.
发生这种情况时,我会在这里发布。
Update 30/10: The issue was with the version of Node.js being used - They've now updated and I can confirm that the payload is now being sent with requests. 2010 年 3 月 30 日更新:问题在于所使用的 Node.js 版本 - 他们现在已经更新,我可以确认负载现在正在与请求一起发送。 You should be good to go.
你应该很高兴去。
That definitely looks like the correct code to me.对我来说,这绝对是正确的代码。
Have you tried making var testendpoint = 'http://requestb.in/12qc4a11';
你有没有试过让
var testendpoint = 'http://requestb.in/12qc4a11';
or something using the wonderful http://requestb.in/ service?或使用美妙的http://requestb.in/服务?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.