15672: Changes the list method to use the POST special case
authorEric Biagiotti <ebiagiotti@veritasgenetics.com>
Fri, 1 Nov 2019 14:16:27 +0000 (10:16 -0400)
committerLucas Di Pentima <lucas@di-pentima.com.ar>
Tue, 17 Dec 2019 20:43:40 +0000 (17:43 -0300)
Arvados-DCO-1.1-Signed-off-by: Eric Biagiotti <ebiagiotti@veritasgenetics.com>

src/services/common-service/common-service.ts

index 1c1e0a569d7e485080fa6c9f934177b188c4fc27..262b5c5d55767beb6b851a102906e36c31c38d9d 100644 (file)
@@ -113,11 +113,19 @@ export class CommonService<T> {
             filters: filters ? `[${filters}]` : undefined,
             order: order ? order : undefined
         };
+
+        // Using the POST special case to avoid URI length 414 errors.
+        // See https://doc.arvados.org/v1.4/api/requests.html
+        const formData = new FormData();
+        formData.append("_method", "GET");
+        Object.keys(params).map(key => {
+            if (params[key] !== undefined) {
+                formData.append(key, params[key]);
+            }
+        });
+
         return CommonService.defaultResponse(
-            this.serverApi
-                .get(this.resourceType, {
-                    params: CommonService.mapKeys(_.snakeCase)(params)
-                }),
+            this.serverApi.post(this.resourceType, formData),
             this.actions
         );
     }