使用浏览器发送post请求 适用于内网 并且没有postman的情况下

谷歌浏览器 console 控制台输入 以下命令 允许复制

allow pasting

然后粘贴请求代码 示例:

复制代码
var url = "https://icp.minexiot.com/prod-api/alarmInfo/page";
var params = {
    "page": 1,
    "limit": 10,
    "confirmStatus": 1
};
var xhr = new XMLHttpRequest();
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("authorization", "Bearer eyJhbGciOiJIUzUxMiJ9.eyJ0ZW5hbnRfaWQiOjEsInV1aWQiOiI4ODExMzg1YTRkYTI0YjEwYmRiZTkzNmFkOTIzOGQ4ZSJ9.RDHBj18pAedVLXaqKxx57kfAtBE6MglgO_qHuH41Kuimb5XTq2Jg0WqUa0MhPzYaD2Y8hRIAGcYSK3TKeev_Ew");
xhr.onload = function (e) {
  if (xhr.readyState === 4) {
    if (xhr.status === 200) {
      console.log(xhr.responseText);
    } else {
      console.error(xhr.statusText);
    }
  }
};
xhr.onerror = function (e) {
  console.error(xhr.statusText);
};
xhr.send(JSON.stringify(params));
复制代码

 

 

posted @   官萧何  阅读(531)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
点击右上角即可分享
微信分享提示