This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
bytedo
/
wcui
Archived
1
0
Fork 0

修改request模块,只要是ajax, 都加上x-requested-with头

old
宇天 2018-08-24 18:05:07 +08:00
parent e25ff4286e
commit 263f6b5dea
1 changed files with 4 additions and 3 deletions

View File

@ -438,10 +438,11 @@ class _Request {
}
}
// 2.3 如果不是跨域请求则自动加上一条header信息用以标识这是ajax请求
if (!this.opt.crossDomain) {
// 2.3 如果不是JSONP则自动加上一条header信息用以标识这是ajax请求
if (this.opt.method !== 'JSONP') {
this.set('X-Requested-With', 'XMLHttpRequest')
} else {
}
if (this.opt.crossDomain) {
supportCors && (this.xhr.withCredentials = true)
}