Closed ouqinglai closed 7 years ago
Huh, that's an interesting difference. It looks like XMLHttpRequest in Chrome extension mode sends Origin
while Chrome's native fetch
implementation doesn't.
But in any case, there's nothing we can do about this. This polyfill only adds fetch
to browsers that don't have it, and Chrome has its own native fetch. See https://github.com/github/fetch#read-this-first
when I use jquery ajax , origin not null
POST /img_vcode HTTP/1.1
Connection: keep-alive
Content-Length: 20458
Accept: */*
Origin: chrome-extension://heeccdnamoclifendpddiikndnkfhdpi
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64)...
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
when I use native fetch api , origin is null
I set headers not work
new Headers({
'Content-Type' : 'application/x-www-form-urlencoded;charset=utf-8',
'Origin' : 'chrome-extension://heeccdnamoclifendpddiikndnkfhdpi',//not work
})
Accept:*/*
Connection:keep-alive
Content-Length:20458
content-type:application/x-www-form-urlencoded;charset=utf-8
Origin:null
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64)...