浏览器console发送post请求

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const text = `
18  0.5 18
19  0.5S  19
20  1 20
21  2 21
22  3 22
23  0.25  23
24  1.5 24
25  2.5 25
26  3.5 26
27  5 27
28  10  28
29  20  29
30  A级  30
31  B级  31
32  C级  32
33  D级  33
34  E级  34
35  0.2SS 35
36  0.5SS 36
99  其他  99
`;
 
const arr = text.split("\n").filter(v => !!v).map(v => ({
  code: v.split("\t")[0],
  value: v.split("\t")[1]
}));
 
for (let i = 0; i < arr.length; i++) {
  const d = arr[i];
  fetch("http://localhost:30376/api/sysDictData/add", {
    "headers": {
      "accept": "application/json, text/plain, */*",
      "accept-language": "zh-CN,zh;q=0.9",
      "authorization": "Bearer eyJhbGciOiJIUzUxMiJ9.eyJ1c2VySWQiOjEsImFjY291bnQiOiJzdXBlckFkbWluIiwidXVpZCI6ImVjZTVhZWY3LWZiNzktNDRhNC1iZWVjLTU2NjhiOGE1MzExMiIsInN1YiI6IjEiLCJpYXQiOjE2ODQxMjM1MTQsImV4cCI6MTY4NTIwOTkxNH0.MUyaSQ5X9YpoT4z03PQW389eme-XkBkI_FAwugtKghI2VbvadDoLAoZoj9zx7emriaTG4_wauXHlRlxFqqCI8Q",
      "content-type": "application/json;charset=UTF-8"
    },
    "referrer": "http://localhost:30376/dict",
    "referrerPolicy": "strict-origin-when-cross-origin",
    "body": `{"typeId":"1432639879270391809","value":"${d.value}","code":"${d.code}","sort":100 }`,
    "method": "POST",
    "mode": "cors",
    "credentials": "include"
  });
}

  

 
posted @   Peter.Jones  阅读(325)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 在鹅厂做java开发是什么体验
· 百万级群聊的设计实践
· WPF到Web的无缝过渡:英雄联盟客户端的OpenSilver迁移实战
· 永远不要相信用户的输入:从 SQL 注入攻防看输入验证的重要性
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
历史上的今天:
2021-05-17 MYSQL相关知识
2020-05-17 java.util.Queue源码
2019-05-17 git报错 git push origin master fatal: 'origin' does not appear to be a git repository fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repositor
点击右上角即可分享
微信分享提示