From d7688b485dea23a132bb8c2e018fb7299000e8cb Mon Sep 17 00:00:00 2001 From: Sefa Ilkimen Date: Wed, 24 Mar 2021 06:54:59 +0100 Subject: [PATCH] fix: e2e test returns false positive due to test timing (request finished to early) --- src/android/com/silkimen/cordovahttp/CordovaHttpBase.java | 5 +++++ test/e2e-specs.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/android/com/silkimen/cordovahttp/CordovaHttpBase.java b/src/android/com/silkimen/cordovahttp/CordovaHttpBase.java index b8f95aa..d3b028c 100644 --- a/src/android/com/silkimen/cordovahttp/CordovaHttpBase.java +++ b/src/android/com/silkimen/cordovahttp/CordovaHttpBase.java @@ -187,6 +187,11 @@ abstract class CordovaHttpBase implements Runnable { request.part(name, fileNames.getString(i), types.getString(i), new ByteArrayInputStream(bytes)); } } + + // prevent sending malformed empty multipart requests (#372) + if (buffers.length == 0) { + request.contentType(HttpRequest.CONTENT_TYPE_FORM); + } } } diff --git a/test/e2e-specs.js b/test/e2e-specs.js index 17f5aaa..89f5046 100644 --- a/test/e2e-specs.js +++ b/test/e2e-specs.js @@ -92,7 +92,7 @@ const helpers = { } return true; }, - getAbortDelay: function () { return 10; }, + getAbortDelay: function () { return 0; }, }; const messageFactory = {