You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2018/06/18 18:38:29 UTC

[airavata-django-portal] 02/02: Only stringify body if not string or FormData

This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git

commit 18c7dc1139820e52690a41f88304f686f7c57b55
Author: Marcus Christie <ma...@iu.edu>
AuthorDate: Mon Jun 18 14:38:18 2018 -0400

    Only stringify body if not string or FormData
---
 .../apps/api/static/django_airavata_api/js/utils/FetchUtils.js        | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/django_airavata/apps/api/static/django_airavata_api/js/utils/FetchUtils.js b/django_airavata/apps/api/static/django_airavata_api/js/utils/FetchUtils.js
index 9182dc3..7395690 100644
--- a/django_airavata/apps/api/static/django_airavata_api/js/utils/FetchUtils.js
+++ b/django_airavata/apps/api/static/django_airavata_api/js/utils/FetchUtils.js
@@ -67,7 +67,7 @@ export default {
         incrementCount();
         return fetch(url, {
             method: 'post',
-            body: JSON.stringify(body),
+            body: (body instanceof FormData || typeof body === 'string') ? body : JSON.stringify(body),
             headers: headers,
             credentials: "same-origin"
         }).then((response) => {
@@ -91,7 +91,7 @@ export default {
         incrementCount();
         return fetch(url, {
             method: 'put',
-            body: JSON.stringify(body),
+            body: (body instanceof FormData || typeof body === 'string') ? body : JSON.stringify(body),
             headers: headers,
             credentials: "same-origin"
         }).then((response) => {

-- 
To stop receiving notification emails like this one, please contact
machristie@apache.org.