Reviewers: shindig.remailer_gmail.com,

Description:
This patch removes the classification of 3xx responses as errors
(populating resp.errors) in gadgets.io.makeRequest.

To avoid incorrectly parsing 3xx response content (often HTML snippets),
such responses are treated as TEXT.

Please review this at http://codereview.appspot.com/152070

Affected files:
  features/src/main/javascript/features/core.io/io.js


Index: features/src/main/javascript/features/core.io/io.js
===================================================================
--- features/src/main/javascript/features/core.io/io.js (revision 835015)
+++ features/src/main/javascript/features/core.io/io.js (working copy)
@@ -159,9 +159,16 @@
      oauthErrorText: data.oauthErrorText,
      errors: []
     };
-    if(resp.rc < 200 || resp.rc > 206){
+
+    if (resp.rc < 200 || resp.rc >= 400){
        resp.errors = [resp.rc + " Error"]
     } else if (resp.text) {
+      if (resp.rc >= 300 && resp.rc < 400) {
+        // Redirect pages will usually contain arbitrary
+        // HTML which will fail during parsing, inadvertently
+        // causing a 500 response. Thus we treat as text.
+        params.CONTENT_TYPE = "TEXT";
+      }
       switch (params.CONTENT_TYPE) {
         case "JSON":
         case "FEED":


Reply via email to