com.mashape.unirest.request.HttpRequest.getHttpMethod()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(121)

本文整理了Java中com.mashape.unirest.request.HttpRequest.getHttpMethod()方法的一些代码示例,展示了HttpRequest.getHttpMethod()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpRequest.getHttpMethod()方法的具体详情如下:
包路径:com.mashape.unirest.request.HttpRequest
类名称:HttpRequest
方法名:getHttpMethod

HttpRequest.getHttpMethod介绍

暂无

代码示例

代码示例来源:origin: Kong/unirest-java

switch (request.getHttpMethod()) {
case GET:
  reqObj = new HttpGet(urlToRequest);
if (!(request.getHttpMethod() == HttpMethod.GET || request.getHttpMethod() == HttpMethod.HEAD)) {
  if (request.getBody() != null) {
    HttpEntity entity = request.getBody().getEntity();

代码示例来源:origin: com.mashape.unirest/unirest-java

switch (request.getHttpMethod()) {
case GET:
  reqObj = new HttpGet(urlToRequest);
if (!(request.getHttpMethod() == HttpMethod.GET || request.getHttpMethod() == HttpMethod.HEAD)) {
  if (request.getBody() != null) {
    HttpEntity entity = request.getBody().getEntity();

代码示例来源:origin: com.github.bingoohuang/unirest-java

switch (request.getHttpMethod()) {
case GET:
  reqObj = new HttpGet(urlToRequest);
if (!(request.getHttpMethod() == HttpMethod.GET || request.getHttpMethod() == HttpMethod.HEAD)) {
  if (request.getBody() != null) {
    HttpEntity entity = request.getBody().getEntity();

代码示例来源:origin: com.github.bingoohuang/blackcat-instrument

public static void prepareRPC(HttpRequest httpRequest) {
  val context = threadLocal.get();
  if (context == null) return;
  val httpMethod = httpRequest.getHttpMethod().name();
  trace("RPC", httpMethod + ":" + httpRequest.getUrl());
  httpRequest.header(BLACKCAT_TRACEID, context.getTraceId());
  val linkId = context.getParentLinkId() + String.format(".%06d", context.getSubLinkId());
  httpRequest.header(BLACKCAT_LINKID, linkId);
}

代码示例来源:origin: net.dv8tion/JDA

private JSONObject toObject(BaseRequest request)
{
  try
  {
    if (api.isDebug())
    {
      System.out.printf("Requesting %s -> %s\n\tPayload: %s\n\tResponse: ", request.getHttpRequest().getHttpMethod().name(), request.getHttpRequest().getUrl(), ((request instanceof RequestBodyEntity)? ((RequestBodyEntity) request).getBody().toString():"None"));
    }
    String body = request.asString().getBody();
    if (api.isDebug())
    {
      System.out.println(body);
    }
    return body == null ? null : new JSONObject(body);
  }
  catch (UnirestException e)
  {
    e.printStackTrace();
  }
  return null;
}

代码示例来源:origin: net.dv8tion/JDA

private JSONArray toArray(BaseRequest request)
{
  try
  {
    if (api.isDebug())
    {
      System.out.printf("Requesting %s -> %s\n\tPayload: %s\n\tResponse: ", request.getHttpRequest().getHttpMethod().name(), request.getHttpRequest().getUrl(), ((request instanceof RequestBodyEntity)? ((RequestBodyEntity) request).getBody().toString():"None"));
    }
    String body = request.asString().getBody();
    if (api.isDebug())
    {
      System.out.println(body);
    }
    return body == null ? null : new JSONArray(body);
  }
  catch (UnirestException e)
  {
    e.printStackTrace();
  }
  return null;
}

相关文章