问题描述
我正在尝试与Google Api进行交互。可悲的是,它们要求在请求正文(后请求)中发送像标识符一样的smth,特别是Unicode字符0x12。我尝试了多种方法,例如fromCharCode或直接在正文中发送unicode(u \ 0012)。它必须与js配合使用,因为当我试图通过请求生成器(我想是.net)发送请求时,我能够获得正确的响应。
这是我当前的代码(无效)。
const XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
const unicode = '\u0012'
function request() {
const xhr = new XMLHttpRequest();
xhr.open('POST','https://xxx.xxx',true);
xhr.setRequestHeader('Content-Type','application/x-protobuf');
xhr.onload = () => {
var response = xhr.responseText;
console.log(response);
};
xhr.send('somedata' + unicode +'4moredata');
}
request();
如果有人可以帮助我,那会很好。祝你有美好的一天;)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)