lib/wunderbar/cgi-methods.rb in wunderbar-0.18.3 vs lib/wunderbar/cgi-methods.rb in wunderbar-0.19.0

- old
+ new

@@ -129,14 +129,13 @@ env = scope.env accept = env['HTTP_ACCEPT'].to_s path_info = env['PATH_INFO'].to_s # implied request types - xhr_json = Wunderbar::Options::XHR_JSON || (accept =~ /json/) || - env['HTTP_X_REQUESTED_WITH'].to_s == 'XMLHttpRequest' - text = Wunderbar::Options::TEXT || - (accept =~ /plain/ and accept !~ /html/) + text = Wunderbar::Options::TEXT || (accept =~ /plain/ && accept !~ /html/) + xhr_json = Wunderbar::Options::XHR_JSON || (accept =~ /json/) + xhr_json ||= !text && env['HTTP_X_REQUESTED_WITH'].to_s=='XMLHttpRequest' @xhtml = (accept =~ /xhtml/ or accept == '') @pdf = (accept =~ /pdf/) # parse json arguments if xhr_json and request and request.respond_to? :body @@ -149,10 +148,10 @@ xhtml_override = ARGV.include?('--xhtml') html_override = ARGV.include?('--html') @pdf ||= ARGV.include?('--pdf') # overrides via the uri query parameter - xhr_json ||= (path_info.end_with? '.json') + # xhr_json ||= (path_info.end_with? '.json') text ||= (path_info.end_with? '.text') @pdf ||= (path_info.end_with? '.pdf') xhtml_override ||= (path_info.end_with? '.xhtml') html_override ||= (path_info.end_with? '.html')