(Req req, String contentType)
| 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")); |
no test coverage detected