接口加解密
防重放
- 封装统一的发送方法
- 过滤器校验
ES6=>axios
AJAX=>headers
function send() {
$.ajax({
type: "GET",
headers: {
Token: "XXXX",
rnd: Math.random()
},
withCredentials: true,
url: "/hello",
data: { "name": "你好 世界" },
contentType: "application/json",
dataType: "text",
success: function (data) {
console.log(data)
},
error: function (data) {
}
});
}
String token = request.getHeader("Token");
String rnd = request.getHeader("rnd");
// 通过去重的思路来做 Redis or map Queue