com.jayway.restassured.response.Response.getContentType()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(129)

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

Response.getContentType介绍

暂无

代码示例

代码示例来源:origin: guru.nidi.raml/raml-tester

@Override
public String getContentType() {
  return response.getContentType();
}

代码示例来源:origin: nidi3/raml-tester

@Override
public String getContentType() {
  return response.getContentType();
}

代码示例来源:origin: com.jayway.restassured/rest-assured

/**
 * Clone an already existing response.
 *
 * @return Builder.
 */
public ResponseBuilder clone(Response response) {
  if (isRestAssuredResponse(response)) {
    final RestAssuredResponseImpl raResponse = raResponse(response);
    restAssuredResponse.setContent(raResponse.getContent());
    restAssuredResponse.setHasExpectations(raResponse.getHasExpectations());
    restAssuredResponse.setDefaultContentType(raResponse.getDefaultContentType());
    restAssuredResponse.setDecoderConfig(raResponse.getDecoderConfig());
    restAssuredResponse.setSessionIdName(raResponse.getSessionIdName());
    restAssuredResponse.setConnectionManager(raResponse.getConnectionManager());
    restAssuredResponse.setConfig(raResponse.getConfig());
    restAssuredResponse.setRpr(raResponse.getRpr());
    restAssuredResponse.setLogRepository(raResponse.getLogRepository());
    restAssuredResponse.setFilterContextProperties(raResponse.getFilterContextProperties());
  } else {
    restAssuredResponse.setContent(response.asInputStream());
  }
  restAssuredResponse.setContentType(response.getContentType());
  restAssuredResponse.setCookies(response.getDetailedCookies());
  restAssuredResponse.setResponseHeaders(response.getHeaders());
  restAssuredResponse.setStatusCode(response.getStatusCode());
  restAssuredResponse.setStatusLine(response.getStatusLine());
  return this;
}

代码示例来源:origin: org.w3/ldp-testsuite

@Test(
    groups = {SHOULD},
    description = "LDP clients SHOULD use the HTTP If-Match header and HTTP ETags "
        + "to ensure it isn’t modifying a resource that has changed since the "
        + "client last retrieved its representation. LDP servers SHOULD require "
        + "the HTTP If-Match header and HTTP ETags to detect collisions.")
@SpecTest(
    specRefUri = LdpTestSuite.SPEC_URI + "#ldpr-put-precond",
    testMethod = METHOD.AUTOMATED,
    approval = STATUS.WG_APPROVED,
    comment = "Covers only part of the specification requirement. "
        + "testConditionFailedStatusCode, testPreconditionRequiredStatusCode "
        + "and testPutBadETag covers the rest.")
public void testPutRequiresIfMatch() throws URISyntaxException {
  skipIfMethodNotAllowed(HttpMethod.PUT);
  String resourceUri = getResourceUri();
  Response response = buildBaseRequestSpecification()
    .expect()
      .statusCode(isSuccessful())
      .header(ETAG, isValidEntityTag())
    .when()
      .get(resourceUri);
  buildBaseRequestSpecification()
      .contentType(response.getContentType())
      .body(response.asByteArray())
    .expect()
      .statusCode(not(isSuccessful()))
    .when()
      .put(resourceUri);
}

代码示例来源:origin: org.w3/ldp-testsuite

.when()
      .get(resourceUri);
String contentType = response.getContentType();

代码示例来源:origin: org.w3/ldp-testsuite

.contentType(response.getContentType())
.header(IF_MATCH, "\"This is not the ETag you're looking for\"") // bad ETag value
.body(response.asByteArray())

相关文章