我已经在我的 nodeJs 后端编写了这段代码
const url = "localhost:8080/job/test/build";
const username = "admin";
const password = "116c197495ef372f129b85a8a2ca4aadc2";
const token = Buffer.from(`${username}:${password}`, "utf8").toString(
"base64"
);
const data = {
}
axios
.post(url, {
headers: {
Authorization: `Basic ${token}`,
},
})
.then((response) => res.send(response)).catch((e) => {console.log(e)});
我收到以下错误
具有相同凭据的相同请求正在邮递员中工作。
答案 0 :(得分:2)
在 url 中使用 http
,就像这样"
const url = "http://localhost:8080/job/test/build";