@capacitor/android 5.2.0 → 5.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -169,6 +169,16 @@ public class CapacitorHttpUrlConnection implements ICapacitorHttpUrlConnection {
169
169
  connection.setDoOutput(shouldDoOutput);
170
170
  }
171
171
 
172
+ /**
173
+ *
174
+ * @param call
175
+ * @throws JSONException
176
+ * @throws IOException
177
+ */
178
+ public void setRequestBody(PluginCall call, JSValue body) throws JSONException, IOException {
179
+ setRequestBody(call, body, null);
180
+ }
181
+
172
182
  /**
173
183
  *
174
184
  * @param call
@@ -194,14 +204,14 @@ public class CapacitorHttpUrlConnection implements ICapacitorHttpUrlConnection {
194
204
  dataString = call.getString("data");
195
205
  }
196
206
  this.writeRequestBody(dataString != null ? dataString : "");
197
- } else if (bodyType.equals("file")) {
207
+ } else if (bodyType != null && bodyType.equals("file")) {
198
208
  try (DataOutputStream os = new DataOutputStream(connection.getOutputStream())) {
199
209
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
200
210
  os.write(Base64.getDecoder().decode(body.toString()));
201
211
  }
202
212
  os.flush();
203
213
  }
204
- } else if (bodyType.equals("formData")) {
214
+ } else if (bodyType != null && bodyType.equals("formData")) {
205
215
  this.writeFormDataRequestBody(contentType, body.toJSArray());
206
216
  } else {
207
217
  this.writeRequestBody(body.toString());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/android",
3
- "version": "5.2.0",
3
+ "version": "5.2.1",
4
4
  "description": "Capacitor: Cross-platform apps with JavaScript and the web",
5
5
  "homepage": "https://capacitorjs.com",
6
6
  "author": "Ionic Team <hi@ionic.io> (https://ionic.io)",