我想用 POST 请求发送表单数据。我已经尝试设置标题和设置有效负载。
req.setPayload("text=you are amazing");
req.addHeader("content-type","application/x-www-form-urlencoded");
结果是,
{message:"Entity body is not json compatible since the received content-type is : text/plain", cause:null}
当使用 setStringPayload 方法时,
req.setStringPayload("text=you are amazing");
req.addHeader("content-type","application/x-www-form-urlencoded");
发生如下错误。
error: senuri/sms-sender:1.0.0/sms_sender.bal:72:5: undefined function 'setStringPayload' in struct 'ballerina/http:Request'
我在 Ubuntu 16.04 和 Ballerina 0.975.0
有什么建议么 ?