lib/assets/javascripts/unpoly/classes/request.coffee in unpoly-rails-0.50.0 vs lib/assets/javascripts/unpoly/classes/request.coffee in unpoly-rails-0.50.1

- old
+ new

@@ -140,10 +140,11 @@ # XMLHttpRequest expects null for an empty body xhrData = null xhrHeaders[up.protocol.config.targetHeader] = @target if @target xhrHeaders[up.protocol.config.failTargetHeader] = @failTarget if @failTarget + xhrHeaders['X-Requested-With'] ||= 'XMLHttpRequest' unless @isCrossDomain() if csrfToken = @csrfToken() xhrHeaders[up.protocol.config.csrfHeader] = csrfToken xhr.open(xhrMethod, xhrUrl) @@ -191,11 +192,14 @@ $form.hide().appendTo('body') up.browser.submitForm($form) # Returns a csrfToken if this request requires it csrfToken: => - if !@isSafe() && !u.isCrossDomain(@url) + if !@isSafe() && !@isCrossDomain() up.protocol.csrfToken() + + isCrossDomain: => + u.isCrossDomain(@url) buildResponse: (xhr) => responseAttrs = method: @method url: @url