Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

only include XML if the response was XML

  • Loading branch information...
commit 4bba140f7a7c37776499343c7f520f8dc65a8275 1 parent cc5f1d0
@bytespider bytespider authored
Showing with 10 additions and 1 deletion.
  1. +10 −1 src/OAuth/Consumer.js
View
11 src/OAuth/Consumer.js
@@ -137,7 +137,16 @@
}
}
- var responseObject = {text: xhr.responseText, xml: xhr.responseXML || undefined, requestHeaders: requestHeaders, responseHeaders: responseHeaders};
+ var includeXML = false;
+ if ('Content-Type' in responseHeaders)
+ {
+ if (responseHeaders['Content-Type'] == 'text/xml')
+ {
+ includeXML = true;
+ }
+
+ }
+ var responseObject = {text: xhr.responseText, xml: (includeXML ? xhr.responseXML : ''), requestHeaders: requestHeaders, responseHeaders: responseHeaders};
// we are powerless against 3xx redirects
if((xhr.status >= 200 && xhr.status <= 226) || xhr.status == 304 || xhr.status === 0) {
Please sign in to comment.
Something went wrong with that request. Please try again.