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

@ -166,7 +166,9 @@ public class Global {
timer.schedule(new TimerTask() {
@Override
public void run() {
if (!executor.isShutdown()) executor.submit(() -> {func.call();});
if (!executor.isShutdown()) executor.submit(() -> {
func.call();
});
}
}, delay);
}
@ -190,7 +192,7 @@ public class Global {
private RequestBody getPostBody(Req req, String contentType) {
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.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);
}

Loading…
Cancel
Save