pull/137/head
FongMi 2 years ago
parent 17e269720e
commit fdbd55aac6
  1. 4
      quickjs/src/main/java/com/fongmi/quickjs/bean/Req.java
  2. 6
      quickjs/src/main/java/com/fongmi/quickjs/method/Global.java

@ -22,7 +22,7 @@ public class Req {
@SerializedName("method") @SerializedName("method")
private String method; private String method;
@SerializedName("body") @SerializedName("body")
private JsonElement body; private String body;
@SerializedName("data") @SerializedName("data")
private JsonElement data; private JsonElement data;
@SerializedName("headers") @SerializedName("headers")
@ -52,7 +52,7 @@ public class Req {
return TextUtils.isEmpty(method) ? "get" : method; return TextUtils.isEmpty(method) ? "get" : method;
} }
public JsonElement getBody() { public String getBody() {
return body; return body;
} }

@ -166,7 +166,9 @@ public class Global {
timer.schedule(new TimerTask() { timer.schedule(new TimerTask() {
@Override @Override
public void run() { public void run() {
if (!executor.isShutdown()) executor.submit(() -> {func.call();}); if (!executor.isShutdown()) executor.submit(() -> {
func.call();
});
} }
}, delay); }, delay);
} }
@ -190,7 +192,7 @@ public class Global {
private RequestBody getPostBody(Req req, String contentType) { private RequestBody getPostBody(Req req, String contentType) {
if (req.getData() != null && req.getPostType().equals("form")) return getFormBody(req); if (req.getData() != null && req.getPostType().equals("form")) return getFormBody(req);
if (req.getData() != null) return RequestBody.create(gson.toJson(req.getData()), MediaType.get("application/json")); if (req.getData() != null) return RequestBody.create(gson.toJson(req.getData()), MediaType.get("application/json"));
if (req.getBody() != null && contentType != null) return RequestBody.create(gson.toJson(req.getBody()), MediaType.get(contentType)); if (req.getBody() != null && contentType != null) return RequestBody.create(req.getBody(), MediaType.get(contentType));
return RequestBody.create("", null); return RequestBody.create("", null);
} }

Loading…
Cancel
Save