Created
June 19, 2014 07:44
-
-
Save sakatam/f40d93f911930ade0d68 to your computer and use it in GitHub Desktop.
AngularJS x Rails - $httpモジュールからの XHR が text/html と認識されちゃう問題 ref: http://qiita.com/sakatam/items/feff580add9b76e6f538
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$httpProvider.defaults.headers.common["Accept"] = 'application/json'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$httpProvider.defaults.headers.common["Accept"] = 'application/json'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BROWSER_LIKE_ACCEPTS = /,\s*\*\/\*|\*\/\*\s*,/ | |
def valid_accept_header | |
(xhr? && (accept.present? || content_mime_type)) || | |
(accept.present? && accept !~ BROWSER_LIKE_ACCEPTS) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment