我正在使用Express进行API开发,需要在调用GET API调用时提交HTML表单
我添加了以下代码,从浏览器中打开它可以正常工作,但是从Postman或Angular HTTP GET调用时,它不会提交表单。
控制器代码:
zohoFormSubmit: async (req, res, next) => {
res.writeHead(200, { 'Content-Type': 'text/html' });
res.write('<html><body><meta http-equiv="content-type" content="text/html;charset=UTF-8"><form name="WebToLeads25788000000071001" method="POST" accept-charset="UTF-8" id="zohoForm" action="https://**.zoho.in/crm/**"><input type="text" name="****" value="**" /><input type="hidden" name="zc_gad" id="zc_gad" value="" /><input type="text" name="xmIwtLD" value="**" /><input type="text" name="actionType" value="TGVhZHM=" /><input type="text" name="returnURL" value="https://login.sthalmatrimony.com/" /><input type="text" name="First Name" value="MANGESH" /><input type="text" name="Last Name" value="MANGESH" /><input type="text" name="Email" value="**@gmail.com" /><input type="text" name="Mobile" value="*****" /><input type="text" name="City" value="Pune" /></form><script type="text/javascript">document.WebToLeads25788000000071001.submit();</script></body></html>');
res.end();
}
[如果有人遇到同一场景,请在这里帮助。谢谢
res.send("<>HTML here</>")
或res.sendFile(<fileName>)