Remove X-Requested-With header to avoid CORS preflight requests

pull/667/merge
Thibaut Courouble 8 years ago
parent 6aaba67b11
commit 786a549f0f

@ -75,9 +75,6 @@ applyHeaders = (xhr, options) ->
if options.dataType
options.headers['Accept'] = MIME_TYPES[options.dataType] or options.dataType
if isSameOrigin(options.url)
options.headers['X-Requested-With'] = 'XMLHttpRequest'
for key, value of options.headers
xhr.setRequestHeader(key, value)
return
@ -111,9 +108,6 @@ abort = (xhr) ->
xhr.abort()
return
isSameOrigin = (url) ->
url.indexOf('http') isnt 0 or url.indexOf(location.origin) is 0
parseResponse = (xhr, options) ->
if options.dataType is 'json'
parseJSON(xhr.responseText)

Loading…
Cancel
Save