本文整理了Java中com.mashape.unirest.http.Unirest.delete()
方法的一些代码示例,展示了Unirest.delete()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Unirest.delete()
方法的具体详情如下:
包路径:com.mashape.unirest.http.Unirest
类名称:Unirest
方法名:delete
暂无
代码示例来源:origin: lets-blade/blade
protected HttpRequest delete(String path) {
log.info("[DELETE] {}", (origin + path));
return Unirest.delete(origin + path);
}
代码示例来源:origin: lets-blade/blade
protected String deleteBodyString(String path) throws Exception {
log.info("[DELETE] {}", (origin + path));
return Unirest.delete(origin + path).asString().getBody();
}
代码示例来源:origin: io.joshworks/snappy-core
public static HttpRequestWithBody delete(String url) {
return Unirest.delete(url);
}
代码示例来源:origin: io.joshworks/snappy
public static HttpRequestWithBody delete(String url) {
return Unirest.delete(ClientManager.lookup(url));
}
代码示例来源:origin: thejamesthomas/javabank
public int deleteAllImposters() {
try {
HttpResponse<JsonNode> response = Unirest.delete(baseUrl + "/imposters").asJson();
return response.getStatus();
} catch (UnirestException e) {
return 500;
}
}
代码示例来源:origin: net.dv8tion/JDA
public JSONObject delete(String url)
{
return toObject(addHeaders(Unirest.delete(url)));
}
代码示例来源:origin: net.dv8tion/JDA
public JSONArray deleteA(String url)
{
return toArray(addHeaders(Unirest.delete(url)));
}
代码示例来源:origin: thejamesthomas/javabank
public String deleteImposter(int port) {
try {
HttpResponse<JsonNode> response = Unirest.delete(baseUrl + "/imposters/" + port).asJson();
return response.getBody().toString();
} catch (UnirestException e) {
return null;
}
}
代码示例来源:origin: unipop-graph/unipop
private BaseRequest executeDelete(String baseUrl, Object urlMap, Object bodyMap) {
HttpRequestWithBody delete = Unirest.delete(baseUrl + urlTemplate.execute(urlMap));
if (bodyTemplate != null)
return delete.body(bodyTemplate.execute(bodyMap));
return delete;
}
代码示例来源:origin: ContainerSolutions/minimesos
/**
* Kill all apps that are currently running.
*/
@Override
public void killAllApps() {
String marathonEndpoint = getServiceUrl().toString();
JSONObject appsResponse;
try {
appsResponse = Unirest.get(marathonEndpoint + APPS_ENDPOINT).header(HEADER_ACCEPT, APPLICATION_JSON).asJson().getBody().getObject();
if (appsResponse.length() == 0) {
return;
}
} catch (UnirestException e) {
throw new MinimesosException("Could not retrieve apps from Marathon at " + marathonEndpoint, e);
}
JSONArray apps = appsResponse.getJSONArray("apps");
for (int i = 0; i < apps.length(); i++) {
JSONObject app = apps.getJSONObject(i);
String appId = app.getString("id");
try {
Unirest.delete(marathonEndpoint + APPS_ENDPOINT + appId).asJson();
} catch (UnirestException e) { //NOSONAR
// failed to delete one app; continue with others
LOGGER.error("Could not delete app " + appId + " at " + marathonEndpoint, e);
}
}
}
代码示例来源:origin: CognitiveJ/cognitivej
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);
}
代码示例来源:origin: thejamesthomas/javabank
@Test
public void shouldDeleteAllImposters() throws UnirestException {
when(Unirest.delete(Client.DEFAULT_BASE_URL + "/imposters")).thenReturn(requestWithBody);
when(requestWithBody.asJson()).thenReturn(httpResponse);
when(httpResponse.getStatus()).thenReturn(Integer.valueOf(200));
assertThat(client.deleteAllImposters()).isEqualTo(200);
}
代码示例来源:origin: thejamesthomas/javabank
@Test
public void shouldDeleteAnImposter() throws UnirestException {
String deleteResponse = "{ url: http://localhost:5757 }";
when(Unirest.delete(Client.DEFAULT_BASE_URL + "/imposters/5757")).thenReturn(requestWithBody);
when(requestWithBody.asJson()).thenReturn(httpResponse);
when(httpResponse.getBody()).thenReturn(value);
when(value.toString()).thenReturn(deleteResponse);
String response = client.deleteImposter(5757);
assertThat(response).contains("5757").contains("http");
}
代码示例来源:origin: com.infotel.seleniumRobot/core
/**
* lock entity object so that it can be found during test
* @param entityType
* @param entityId
* @throws UnirestException
*/
private void unlockEntity(String entityType, String entityId) throws UnirestException {
Unirest.delete(serverUrl + "/rest/domains/{domain}/projects/{project}/{entityType}s/{entityId}/lock")
.routeParam(ENTITY_TYPE, entityType)
.routeParam(ENTITY_ID, entityId)
.routeParam(PROJECT_NAME, project)
.routeParam(DOMAIN_NAME, domain)
.asString();
}
代码示例来源:origin: kevoree/kevoree
default HttpResponse<JsonNode> deleteTdef(String namespace, String name, long version) throws UnirestException, KevoreeRegistryException {
// be sure user is logged-in / refresh token if necessary / throws otherwise
this.ensureLogin();
// DELETE tdef
return Unirest.delete(this.baseUrl() + "/api/namespaces/{namespace}/tdefs/{name}/{version}")
.header("Authorization", "Bearer " + config().getString("user.access_token"))
.routeParam("namespace", namespace)
.routeParam("name", name)
.routeParam("version", String.valueOf(version))
.asJson();
}
}
代码示例来源:origin: gradle.plugin.GoBqa/gradle-plugin
postRequest = Unirest.delete(url + paramUrl);
postRequestNoBody = Unirest.delete(url + paramUrl);
代码示例来源:origin: kevoree/kevoree
default HttpResponse<JsonNode> deleteDu(String namespace, String tdefName, long tdefVersion, String name, String version, String platform)
throws UnirestException, KevoreeRegistryException {
// be sure user is logged-in / refresh token if necessary / throws otherwise
this.ensureLogin();
// DELETE du
return Unirest.delete(this.baseUrl() + "/api/namespaces/{namespace}/tdefs/{tdefName}/{tdefVersion}/dus/{name}/{version}/{platform}")
.header("Authorization", "Bearer " + config().getString("user.access_token"))
.routeParam("namespace", namespace)
.routeParam("tdefName", tdefName)
.routeParam("tdefVersion", String.valueOf(tdefVersion))
.routeParam("name", name)
.routeParam("version", version)
.routeParam("platform", platform)
.asJson();
}
}
代码示例来源:origin: Kong/Astronode-Broadcaster
break;
case DELETE:
response = Unirest.delete(url).fields(parameters).asJson();
break;
default:
代码示例来源:origin: discord-java/discord.jar
request = Unirest.delete(url);
break;
case OPTIONS:
内容来源于网络,如有侵权,请联系作者删除!