public static HttpRequestWithBody patch(String url) { return Unirest.patch(url); }
public static HttpRequestWithBody patch(String url) { return Unirest.patch(ClientManager.lookup(url)); }
public JSONObject addTestStepsToTestCases(List<String> testSteps) throws UnirestException { if (testSteps.isEmpty()) { return new JSONObject(); } MultipartBody request = Unirest.patch(url + TESTCASEINSESSION_API_URL + testCaseInSessionId + "/").field("testSteps", testSteps.get(0)); for (String tc: testSteps.subList(1, testSteps.size())) { request = request.field("testSteps", tc); } return getJSonResponse(request); }
public JSONArray patchA(String url, JSONObject body) { return toArray(addHeaders(Unirest.patch(url)).body(body.toString())); }
public JSONArray patchA(String url, JSONArray body) { return toArray(addHeaders(Unirest.patch(url)).body(body.toString())); }
public JSONObject patch(String url, JSONObject body) { return toObject(addHeaders(Unirest.patch(url)).body(body.toString())); }
private BaseRequest executePatch(String baseUrl, Object urlMap, Object bodyMap) { return Unirest.patch(baseUrl + urlTemplate.execute(urlMap)).body(bodyTemplate.execute(bodyMap)); }
private void unreserveVariable(TestVariable variable) { if (variable.isReservable() && variable.getId() != null) { try { getJSonResponse(Unirest.patch(String.format(url + EXISTING_VARIABLE_API_URL, variable.getId())) .field("releaseDate", "")); } catch (UnirestException e) { logger.warn("variable could not be unreserved, server will do it automatically after reservation period: " + e.getMessage()); } } }
public void addLogsToTestCaseInSession(String logs) { if (testCaseInSessionId == null) { createTestCaseInSession(); } try { getJSonResponse(Unirest.patch(url + TESTCASEINSESSION_API_URL + testCaseInSessionId + "/").field("stacktrace", logs)); } catch (UnirestException e) { throw new SeleniumRobotServerException("cannot add logs to test case", e); } } public Integer getSessionId() {
private HttpRequest buildUnirest(WorkingContext workingContext) { String url = String.format("%s%s", PROJECTOXFORD_AI, workingContext.getPathBuilt()); switch (workingContext.getHttpMethod()) { case GET: return Unirest.get(url); case PUT: return Unirest.put(url); case DELETE: return Unirest.delete(url); case PATCH: return Unirest.patch(url); } return Unirest.post(url); }
break; case PATCH: response = Unirest.patch(url).fields(parameters).asJson(); break; case DELETE:
break; case PATCH: request = Unirest.patch(url); break; case POST:
JSONObject variableJson = getJSonResponse(Unirest.patch(String.format(url + EXISTING_VARIABLE_API_URL, variable.getId())) .field("value", variable.getValue()) .field("reservable", variable.isReservable()));