MCPcopy Create free account
hub / github.com/FongMi/TV / getPostBody

Method getPostBody

quickjs/src/main/java/com/fongmi/quickjs/utils/Connect.java:68–74  ·  view source on GitHub ↗
(Req req, String contentType)

Source from the content-addressed store, hash-verified

66 }
67
68 private static RequestBody getPostBody(Req req, String contentType) {
69 if (req.getData() != null && "json".equals(req.getPostType())) return getJsonBody(req);
70 if (req.getData() != null && "form".equals(req.getPostType())) return getFormBody(req);
71 if (req.getData() != null && "form-data".equals(req.getPostType())) return getFormDataBody(req);
72 if (req.getBody() != null && contentType != null) return RequestBody.create(req.getBody(), MediaType.get(contentType));
73 return RequestBody.create(new byte[0]);
74 }
75
76 private static RequestBody getJsonBody(Req req) {
77 return RequestBody.create(req.getData().toString(), MediaType.get("application/json; charset=utf-8"));

Callers 1

getRequestMethod · 0.95

Calls 9

getJsonBodyMethod · 0.95
getFormBodyMethod · 0.95
getFormDataBodyMethod · 0.95
getPostTypeMethod · 0.80
getDataMethod · 0.45
equalsMethod · 0.45
getBodyMethod · 0.45
createMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected