我需要一个const来定义这个主体(字符串)。然后我可以用它来做类似的事情console.log()
fetch("url", {
headers: {
"Content-Type": "application/json",
'Authorization': 'Basic ' + btoa(globalUsername + ":" + globalPassword),
},
method: "POST",
body: moveBody
}).then(response => console.log(response.status)).
then(response => console.log(response.text(body)));
Run Code Online (Sandbox Code Playgroud)
