org.apache.http.client.fluent.Request.version()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(132)

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

Request.version介绍

暂无

代码示例

代码示例来源:origin: dreamhead/moco

@Override
  public void run() throws Exception {
    Header header = helper.execute(Request.Get(remoteUrl("/template")).version(HttpVersion.HTTP_1_0)).getFirstHeader("foo");
    assertThat(header.getValue(), is("GET"));
  }
});

代码示例来源:origin: dreamhead/moco

public String getWithVersion(final String url, final HttpVersion version) throws IOException {
  return executeAsString(Request.Get(url).version(version));
}

代码示例来源:origin: dreamhead/moco

@Override
  public void run() throws Exception {
    Request request = Request.Get(root()).version(HttpVersion.HTTP_1_0).addHeader("Connection", "keep-alive");
    HttpResponse response = helper.execute(request);
    String connection = response.getFirstHeader("Connection").getValue();
    assertThat(connection, is("keep-alive"));
  }
});

代码示例来源:origin: dreamhead/moco

@Override
  public void run() throws Exception {
    Request request = Request.Get(root()).version(HttpVersion.HTTP_1_1).addHeader("Connection", "keep-alive");
    HttpResponse response = helper.execute(request);
    assertThat(response.getFirstHeader("Connection"), nullValue());
  }
});

代码示例来源:origin: dreamhead/moco

@Override
  public void run() throws Exception {
    ProtocolVersion version = helper.execute(Request.Get(remoteUrl("/template"))
        .version(HttpVersion.HTTP_1_0))
        .getProtocolVersion();
    assertThat(version.toString(), is("HTTP/1.0"));
  }
});

代码示例来源:origin: dreamhead/moco

@Override
  public void run() throws IOException {
    ProtocolVersion version10 = helper.execute(Request.Get(root())
        .version(HttpVersion.HTTP_1_0))
        .getProtocolVersion();
    assertThat(version10.getMajor(), is(1));
    assertThat(version10.getMinor(), is(0));
    ProtocolVersion version11 = helper.execute(Request.Get(root())
        .version(HttpVersion.HTTP_1_1))
        .getProtocolVersion();
    assertThat(version11.getMajor(), is(1));
    assertThat(version11.getMinor(), is(1));
  }
});

代码示例来源:origin: dreamhead/moco

@Override
  public void run() throws IOException {
    ProtocolVersion version10 = helper.execute(Request.Get(root())
        .version(HttpVersion.HTTP_1_0))
        .getProtocolVersion();
    assertThat(version10.getMajor(), is(1));
    assertThat(version10.getMinor(), is(0));
    ProtocolVersion version11 = helper.execute(Request.Get(root())
        .version(HttpVersion.HTTP_1_1))
        .getProtocolVersion();
    assertThat(version11.getMajor(), is(1));
    assertThat(version11.getMinor(), is(1));
  }
});

代码示例来源:origin: dreamhead/moco

@Override
  public void run() throws IOException {
    HttpResponse response10 = helper.execute(Request.Get(remoteUrl("/proxy"))
        .version(HttpVersion.HTTP_1_0));
    assertThat(response10.getProtocolVersion().toString(), is(HttpVersion.HTTP_1_0.toString()));
    HttpResponse response11 = helper.execute(Request.Get(remoteUrl("/proxy"))
        .version(HttpVersion.HTTP_1_1));
    assertThat(response11.getProtocolVersion().toString(), is(HttpVersion.HTTP_1_1.toString()));
    HttpResponse response09 = helper.execute(Request.Get(remoteUrl("/proxy"))
        .version(HttpVersion.HTTP_0_9));
    assertThat(response09.getProtocolVersion().toString(), is(HttpVersion.HTTP_1_0.toString()));
  }
});

代码示例来源:origin: dreamhead/moco

@Test
public void should_return_version_from_template() throws IOException {
  runWithConfiguration("template.json");
  ProtocolVersion version = helper.execute(Request.Get(remoteUrl("/version_template"))
      .version(HttpVersion.HTTP_1_0))
      .getProtocolVersion();
  assertThat(version.toString(), is("HTTP/1.0"));
}

代码示例来源:origin: org.streampipes/streampipes-pipeline-management

.version(HttpVersion.HTTP_1_1)
.execute();

代码示例来源:origin: streampipes/streampipes-ce

.version(HttpVersion.HTTP_1_1)
.execute();

相关文章